beforeCollapse

fires before collapsing an item

void beforeCollapse(string|number id,string dir){ ... };

Parameters

idstring|numberthe id of an item
dirstringoptional, the side the children will be hidden in relation to the parent shape
("left" or "right" for type:"topic", otherwise - undefined)

Example

diagram.events.on("beforeCollapse", function(id, dir) {
    console.log("Collapsing " + diagram.data.getItem(id).text, dir);
    return true;
});
 
// For editor
editor.diagram.events.on("beforeCollapse", function(id, dir) {
    console.log("Collapsing " + editor.diagram.data.getItem(id).text, dir);
    return true;
});

Related samples

Details

Returning false from the handler will block the selection.

See also
Change log

The dir parameter was added in v3.1.

Back to top