Hello, tell me please, I did not find the answer in your documentation.
I have three tables for orders, projects and tasks. The order has projects, and projects have the tasks I need to build this structure in the diagram.
Orders, projects, and tasks have unique ids and they are duplicated in the data. How can I specify where id belongs the order or the project or the task? It should look like this: take.ms/Mn35f
Hello,
you’ll need to preprocess ids of your records before loading them into gantt in order to ensure they’re unique and relations to the parent records are correct.
the simplest solution would be to add prefixes to ids from different tables. E.g. consider you have following tables
projectsid name
1 "project1"
2 "project2"
ordersid name projectId
1 "order1" 1
2 "order2" 1
tasks id name orderId
1 "task1" 1
2 "task2" 2
If you select them in the single array, you’ll get duplicated ids and references to parents will be broken:
id name parent
1 "project1" null
2 "project2" null
1 "order1" 1
2 "order2" 1
1 "task1" 1
2 "task2" 2
The simplest solution here would be to add prefixes based on source table to all ids before merging them into a single array, so instead of the sample above you’ll have something following:
id name parent
"project_1" "project1" null
"project_2" "project2" null
"order_1" "order1" "project_1"
"order_2" "order2" "project_1"
"task_1" "task1" "order_1"
"task_2" "task2" "order_2"
That way all ids will be unique on the client side, hierarchy will be preserved and everything should work as expected