Button control inquiry

I would like to inquire about buttons.
I was wondering if it is possible to know the state of two buttons, PanelExpanderButton, subGraphExpanderButton.
Is it possible to store DB when folded or unfolded?

Do I need to set up to be a relink?
I want to connect to another node by moving the link line, but what should I do when the node is not connected?

Yes, you can store the expanded/collapsed state of a button in your data. See for example the Kanban Board sample, which saves the state in an expanded property. Try collapsing a group and hitting the save button. The JSON will have "expanded": false for collapsed groups.

You can make links relinkable by setting Link.relinkableFrom and Link.relinkableTo. See the intro page on RelinkingTool.

To add some information about the “PanelExpanderButton”:
As you can see in its definition in https://gojs.net/latest/extensions/Buttons.js, the state of the button is controlled by the visible property of the element that is made visible or invisible. By default it should have the GraphObject.name of “COLLAPSIBLE”.

So if you want to persist the state in your model, just add a TwoWay Binding on the “visible” property of that element.