Calling "TreeExpanderButton" functionality without using a Button

thank you @walter .Can you tell me about the Expandbutton’s functionality ,is there is a way to use it as an OnCLick Function ?

Do you mean GoJS Buttons -- Northwoods Software or GoJS Buttons -- Northwoods Software or GoJS Buttons -- Northwoods Software ?

All “Buttons” respond to click events. See how they are all defined at https://gojs.net/latest/extensions/Buttons.js.

$(“TreeExpanderButton”)

you can see in the first diagram (in this post )that the TreeExpanderButton is in the middle of the node , in my case i want its functionality to be used OnClick

I don’t understand your question. When the user clicks on a Button, it’s click event handler is called.

yeah i know , my question is that if IT’S POSSIBLE to use the expand function without a button ? Sorry for bothering you @walter

Oh, I see. OK, but that question seems completely unrelated to your layout question.

Sure, every predefined button such as “TreeExpanderButton” calls functions that do whatever is needed. If you look at the definitions of those buttons, at https://gojs.net/latest/extensions/Buttons.js, you will see exactly how those click event handlers are defined.

In the case of “TreeExpanderButton” it calls methods such as CommandHandler.canCollapseTree and CommandHandler.expandTree. For example: CommandHandler | GoJS API

In the case of “SubGraphExpanderButton” it calls CommandHandler methods such as CommandHandler | GoJS API

In the case of “PanelExpanderButton” it just toggles the value of GraphObject.visible, within a transaction of course.