I have a panel with panelexpanderbutton as shown below.
As shown in above screenshot I can remove the panel content by clicking on “-” button and add content to panel by clicking on “+” button. I am able to control the visibility of the button by data size. My issue is when when I remove the data using “-” button and if panel is empty then the panelexpanderbutton is not visible. At this time the button is in expanded state so when I add data using “+” button it is expanding the panel. But I want the panel to be collapsed when I add data to empty panel.
I want to know is there a way to programatically control the expand and collapse state of PanelExpanderButton. Below is the code
(go.Panel, "Vertical",
{ name: "PROPERTIES",visible:false,columnSpan: 2},
new go.Binding("itemArray", "properties"),
{
row: 1, margin: new go.Margin(12,2,4,4), stretch: go.GraphObject.Fill,
defaultAlignment: go.Spot.Left, background: "lightyellow",
itemTemplate: propertyTemplate
}
),
(“PanelExpanderButton”, “PROPERTIES”,
{ row: 1, column: 1, alignment: go.Spot.TopRight, visible: false },
new go.Binding(“visible”, “properties”, function(arr:any)
{
return arr.length > 0;
}
)
),