Find a specific task from the gantt chart without refreshing the gantt chart

Hi, I have to find specfic task using the task id, without refreshing the gantt chart but gantt.getTask method is not working for deeply nested child task. how can this be accomplished

Hello,

The gantt.getTask() method doesn’t refresh the Gantt chart. If you invoke this method, Gantt won’t be re-rendered on the page.
Please check the example:
https://snippet.dhtmlx.com/9u2llmwc ;
This method returns the task which is loaded into the Gantt, and it doesn’t depend on the tree level of the child task.
Also, you can iterate over all tasks by using the eachTask method:
eachTask Gantt Docs ;
and get the required task.
Please check the example:
https://snippet.dhtmlx.com/bieg4q4f ;
If it doesn’t help you, please, add your configuration in the snippet above and make sure that the issue is reproduced there. Then, click on the Save button and send me the link. Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

Hii @ArtyomBorisevich , I’ve to show the specific task using gantt.showTask(highlight). I’ve the task id of the task which I need to find/highlight. But I’m not able to traverse inside the node which means it’s not highlighting the task if $open = false when the nodes are closed. it is not opening the nodes.

Hello Genni,
If the parent tasks are collapsed, Gantt will still scroll to the horizontal position of the task.
Here is an example:
https://snippet.dhtmlx.com/jgjsbvzd

If you want to expand all parent tasks, you need to do it manually before using the showTask method.
For that, you need to use the open method inside the eachParent method. And to repaint the changes only once, it is better to put all the code inside the batchUpdate method:
https://docs.dhtmlx.com/gantt/api__gantt_open.html
https://docs.dhtmlx.com/gantt/api__gantt_eachparent.html
https://docs.dhtmlx.com/gantt/api__gantt_batchupdate.html

Here is an example:
https://snippet.dhtmlx.com/b01hzc70