Search code examples
extjsextjs4windowextjs4.1extjs4.2

Extjs Window Default Close Button


I have a button inside a panel that once clicked will call out a child window. I already created it and there are already items inside it. Once the child window is opened the parent panel will be disabled.

Inside the child window I have a Button that closes the window which will then enables the parent panel.

  childWindow.close();
  parent.enable();

My problem is the default close button on the Window on the upper right side of the window. If I click it it, I cannot enable the parent panel. it stays disabled, because of course I disabled it.

How do I enable the parent panel once it is closed using the default close button?


Solution

  • Place a listener to the close event of the "child" window inside your "main" window. The listener will work, even if it is disabled. In the following example I assume that the win ref is a reference of your "main" window while "child" is the one of your child.

    openWin: function(child) {
        child.on('close', reactivate, this);
        child.show();
        this.disable();
    },
    reactivate: function() {
        this.enable();
    }