Load resources from API REST


#1

Hy all,

I’m in troble with loading and or using resources data from gantt.load("/resources"):
I think that is not clear to me the exact sintax of this json object, in case of tasks and links, perfect functionality my server returns a json with two keys with list value, what about resource json?
I tried {“resources”:[{},{}…]} , also appending key resources in data object but I’m not able to use it.
Any hint?
thankyou


#2

Hello Mauro,
To load the resources along with tasks from the same JSON object, you need to include the resource data inside the collections object:
https://docs.dhtmlx.com/gantt/desktop__supported_data_formats.html#jsonwithcollections
Before loading the data, you need to create a server list so that Gantt will fill it when parsing the data with the gantt.parse method:
https://docs.dhtmlx.com/gantt/api__gantt_serverlist.html
After that, you can use the parse method from the resource store object to load the resource data.
Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/5/6b4c13f3d