I have a SAPUI5 panel which can be destroyed indirectly in various circumstances for various reasons (e.g. in this example, that parent of the parent is destroyed). Therefore, I must use a function hook coming from the control itself.
I tried to call the exit function (base on this Stack Overflow question and this SAPUI5 documentation)
var oGrandParentPanel = new sap.m.Panel();
var oParentPanel = new sap.m.Panel();
var oPanel = new sap.m.Panel({
exit: function(){
alert("FOOBAR!");
}});
oParentPanel.addContent(oPanel);
oGrandParentPanel.addContent(oParentPanel);
oGrandParentPanel.destroy();
I want a "FOOBAR!" alert, but I am not getting it.