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.


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.

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 … 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)

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; });