Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Accessing Panel expander button functionality programatically

$
0
0

@jothibaskaran wrote:

Hi,
I have a panel expander button on all the nodes in my diagram. When I click on the button, my node expands to display another panel. I have implemented it as follows:

$("PanelExpanderButton", "PROPTEXT",
                    {
                        row: 2, column: 2,
                        margin: new go.Margin(0, 0, 10, 0),
                        'ButtonBorder.fill': 'white', '_buttonFillOver': 'white',
                        '_buttonStrokeOver': 'white',
                        click: (e, btn) => {
                            var diagram = btn.diagram;
                            if (diagram === null) return;
                            if (diagram.isReadOnly) return;
                            var elt = btn.findTemplateBinder();
                            if (elt === null) elt = btn.part;
                            if (elt !== null) {
                            var pan = elt.findObject('PROPTEXT');
                            if (pan !== null) {
                                diagram.startTransaction('Collapse/Expand Panel');
                                pan.visible = !pan.visible;
                                diagram.commitTransaction('Collapse/Expand Panel');
                            }
                            }
                            e.handled = true;
                        },
                        background: 'white'
                    },
                    go.GraphObject.make(go.Shape,
                        { name: 'ButtonIcon', 
                            fill: '#10069f', 
                            stroke: '#10069F', 
                            strokeWidth: 1, 
                            width: 10, 
                            height: 7,
                            background: 'white',
                        },
                        new go.Binding('geometryString', 'visible',
                        (vis) => { return vis ? 'F M24.642,18.124l-1.768,1.768L16,13.017,9.124,19.892,7.357,18.124,16,9.481Zm0,0' : 'F M24.642,13.874l-1.768-1.768L16,18.981,9.124,12.106,7.357,13.874,16,22.517Zm0,0' }
                        ).ofObject('PROPTEXT')
                    )
                ),

Now, I want to have a toggle switch using which I can expand/collapse the PROPTEXT panels of all the nodes that are present in my diagram.

How can this be done?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles