apex-plugin-dhtmlx-gantt icon indicating copy to clipboard operation
apex-plugin-dhtmlx-gantt copied to clipboard

Reordering tasks vertically

Open mappo1980 opened this issue 2 years ago • 1 comments

Hi, I need to sort the tasks vertically and save the order in the database, how can I do it?

mappo1980 avatar Sep 13 '23 13:09 mappo1980

I had the same problem this month. Reordering in the Left side grid is not possible. You have to change/extend the plugin to do it, but it's quite easy.

  1. Add new Event: Task Row Drag End (Grid) - Internal name "dhtmlxgantt_task_row_drag"
  2. Add the event in the file plugin-dhtmlxgantt-helper.js
    //catch task ROW drag event for APEX, so that a dynamic action can be registered
    //boolean onBeforeRowDragEnd(string|number sid,string|number parent,number tindex);
    // https://docs.dhtmlx.com/gantt/api__gantt_onbeforerowdragend_event.html
    gantt.attachEvent("onBeforeRowDragEnd", function(id, parent, tindex){
        var data = {
            parent_id: gantt.getParent(id),
            task: gantt.getTask(id)
        };
        apex.event.trigger(plugin_dhtmlxGantt.chartContainerIdElement, "dhtmlxgantt_task_row_drag", data);
    });

You can now reference the new Event in a Dynamic Action. https://docs.dhtmlx.com/gantt/api__gantt_onbeforerowdragend_event.html

jzzh avatar Sep 27 '24 17:09 jzzh