How to expand/collapse all panels in the diagram programatically?

Assuming your question is duplicated at How to stop the links to the empty space in scrolling table - #7 by walter, I’ll also assume that you have just one “PanelExpanderButton” in your node template.

The Panel must have a name. Then it’s just a matter of:

myDiagram.startTransaction();
myDiagram.nodes.each (function(n) {
    var p = n.findObject("PANELNAME");
    if (p !== null) p.visible = false;
});
myDiagram.commitTransaction("collapsed all panels");