gantt.config.xml_date = "%Y-%m-%d %H:%i:%s";
gantt.config.order_branch = true;
gantt.init("gantt_here");
gantt.load("<%= data_gantts_path %>", "json");
var dp = new dataProcessor("<%= db_action_gantts_path %>");
dp.init(gantt);
What is the attribute name to map a task orrder when setup JSON data initally? Because sortorder with values like 1,2,3 doesn’t work with above setup.
When I reaorder by drag and drop I do have target parameter which I can use. I noticed 2 cases. First when it points to the id of item on which place task was moved. Second, if I put task on the end of the list then I have “next: id_of_last_task” as a target value. Are these all syntax cases in target field when call ‘reorder’ ?
The full integration will work only if you are using connectors on server side, as client side doesn’t use the sortorder field. This field is used for data sorting on server side during data loading and updated when “order” command send to server side.
Client side do not change this field during data reordering, instead of it dataprocessor sends an extra request to server side, with info about moved row id and new position. It expects that server side code will update sortorder field in necessary way.
You can add when "order" section to the db_action and place the logic there. It will require few DB queries.
get sortorder of source row
get sortorder of target row
update sortorder for all involved rows
Also you will need to set sortorder in the database for newly created records.
I did that.
But still, if table gantt_tasks looks like this:
– record 1
name: ‘task1’
sortorder: 3
– record 2
name: ‘task2’
sortorder: 2
– record 3
name: ‘task3’
sortorder: 1
Gantt (basic licence) doesn’t sort it out with my inital setup. I use the following instruction of yours docs.dhtmlx.com/gantt/desktop__h … ganttchart . You can see that there is sortorder field in your gantt_tasks table but when you setup it then it does not work out.
When you are using connector it adds “sort by sortorder” to the SQL query.
If you are using custom backend, you need to apply such kind of initial sorting as well.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan