Is there an api that can dynamically disable or enable drag and drop on the task grid ?
I have tried this method on the button but it has no effect
if(gantt.config.order_branch != "marker"){
gantt.config.order_branch = "marker";
gantt.config.order_branch_free = true;
}else{
gantt.config.order_branch = false;
gantt.config.order_branch_free = false;
}
Hello @realxumai,
Some configure requires force rerendering to be applied, in your case, the “resetLayout” method will be the most appropriate option.
So, the code will look like this fragment:
if(gantt.config.order_branch != "marker"){
gantt.config.order_branch = "marker";
gantt.config.order_branch_free = true;
}else{
gantt.config.order_branch = false;
gantt.config.order_branch_free = false;
}
gantt.resetLayout();
}
Here is a demo:
http://snippet.dhtmlx.com/5/79500f6cc
Also, you can use the “onBeforeRowDragMove” to forbid changing the position of the task in a grid, without changing the config:
gantt.attachEvent("onBeforeRowDragMove", function(id, parent, tindex){
if(someFlagVariable){
return false;
} else {
return true;
}
});
API:
onBeforeRowDragMove
:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforerowdragmove_event.html
resetLayout
:
https://docs.dhtmlx.com/gantt/api__gantt_resetlayout.html
Thank you very much for your help 