Hi I’m trying to update task property before rendering, the main reason for doing this is to avoid looping over entire task data to update common property. I only want to update visible task data, I tried to achive this using onGanttScroll and visible Task ID which worked but not neatly, another way I found is by modifying task object in onBeforeTaskDisplay event which most time leads to infinity re-rendering, is there any way I can achieve visible task update?
Hello Vyshnav,
There are 2 commands that can be used to repaint a task: updateTask
and refreshTask
. The first method will trigger the internal events, and that includes sending the data to the server-side:
https://docs.dhtmlx.com/gantt/api__gantt_updatetask.html
The second method only repaints the task:
https://docs.dhtmlx.com/gantt/api__gantt_refreshtask.html
If you modify a task property in the onBeforeTaskDisplay
event, you need to make sure that you don’t call any of these methods.
Here are examples:
https://snippet.dhtmlx.com/jct9i4p7
https://snippet.dhtmlx.com/b648jkxg
Also, it is not expected to modify a task in the onBeforeTaskDisplay
event handler.
Could you clarify why you need to modify a task before rendering the data?
1 Like