How to filter tasks of a specific level that need to be rendered based on the WBS outline level. For example, the gantt diagram initial display only shows tasks above level 3 outline, while tasks below level 3 are automatically hidden.
Hi @yansen,
In order to do this, you can use the onBeforeTaskDisplay
event, which provides a possibility to display/not display
tasks, based on some conditions, like in this fragment of code:
gantt.attachEvent("onBeforeTaskDisplay", function(id, task){
// wbsLevel is a WBSCode with removed dots(".")
var wbsCode = gantt.getWBSCode(gantt.getTask(id))
var wbsLevel = wbsCode.replace(/[.]/g, "").length;
if (wbsLevel > 3){
return false;
}
return true;
});
Where I returning false(to not display task) if its wbs level
is higher than 3.
Here is a demo:
http://snippet.dhtmlx.com/1abeb3289
API onBeforeTaskDisplay
:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskdisplay_event.html