How to display one task using showTask() ?

Hi, I succeed to load tasks from database using the connector, now I want to display just one task which has 30 as id. I tried this attempt but it didn’t work.

[code]

gantt.config.xml_date = "%Y-%m-%d %H:%i"; gantt.config.scale_unit = "day"; gantt.config.duration_unit = "day"; gantt.config.date_scale = "%d"; gantt.init("gantt_here"); gantt.load("Conector"); gantt.showTask(30); var dp = new dataProcessor("Conector"); dp.init(gantt);[/code] Thanks.

Hello,
note that gantt.load is async method, it means the data is not received when the execution goes to the next line of code (gantt.showTask)

You need to use either onLoadEnd event, or pass a callback function into the gantt.load
docs.dhtmlx.com/gantt/api__gantt_load.html
docs.dhtmlx.com/gantt/api__gantt … event.html

If you want to display that task meaning all others should be hidden, then you need to enable filtering (showTask only does the scrolling)
docs.dhtmlx.com/gantt/desktop__filtering.html

Hi, thank you it works very well, I used the method of filtering, please I have another question , I want to display the task with 30 as id and it’s child, I tried this attempt:

gantt.load("Test_conector"); gantt.attachEvent("onBeforeTaskDisplay", function(id, task){ if (task.text === "www"){ return true; gantt.getChildren("30"); } return false; });
Thanks.