Our state of the art Gantt chart


Post by pushkarajk_kloudgin »

is it possible to collapse only child not parent node


Post by tasnim »

Hi,

When you click on a parent node it collapses its children, Could you please clarify what you mean by collapse only child not parent node? and explain a bit more about your use case.


Post by pushkarajk_kloudgin »

On button click want to collapse only child . I have added one attachment

Attachments
Want to hide only child node
Want to hide only child node
Screenshot 2024-03-28 142954.png (126.96 KiB) Viewed 426 times

Post by pushkarajk_kloudgin »

hey tasnim,

please let me know if you want any other information from our side


Post by ghulam.ghous »

Hi,

You can do something like this:


tbar:{
    items: [
        {
            tag: 'button',
            text:'onClick',
            onClick(){
                gantt.taskStore.records.forEach(task => {
                    if(!task.isLeaf && !task.parent.isRoot){
                        gantt.collapse(task);
                    }
                })
            }
        }
    ]
}

https://bryntum.com/products/gantt/docs/api/Core/data/mixin/TreeNode#property-isLeaf
https://bryntum.com/products/gantt/docs/api/Core/data/mixin/TreeNode#property-isRoot
https://bryntum.com/products/gantt/docs/api/Grid/view/GridBase#function-collapse

Hope it helps

Regards,
Ghous


Post Reply