AI OnAI Off
Well, there's currently no perfect solution for this. What you can do is watch the open property of your parent container, so in startup do something like this:
var handle, parent = this.getParent();
while (parent && !(parent instanceof _ComponentWrapper)) {
parent = parent.getParent();
}
if (parent) {
// Keep a reference to the watch handle so it can be removed when destroying the widget.
handle = parent.watch("open", function (name, oldState, newState) {
console.log("Is open:", newState);
});
}
where _ComponentWrapper is a reference to epi/shell/widget/layout/_ComponentWrapper.
This is a bit hacky since it assumes a bit too much about the widget's surroundings.
I would like to be able to execute code when the user opens (expands) or closes (compress) a Dijit-widget in the widget/gadget list in Edit mode (the ComponentPaneContainer ?).
Trying to add this.on('click', function(e) { ... }); in postCreate-function of the widget only gives a possibility to run code when the user clicks IN the widget. I need to know when the widget is closed or opened, that is when the user clicks on the gadget title.
Is this possible and if yes - how can it be done?