How to use WBS outline level to controll the display of gantt

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:

API onBeforeTaskDisplay: