PDA

View Full Version : [SOLVED] Set config option 'modal' to false for an activated Window



cougar83
22 Oct 2010, 4:37 AM
Hi Forum,

what can I do, to set the Ext.Window config option modal to false after it is instantiated (with modal: true,). I could ask for the parameter, what is actually set, but I found no chance to alter it.

This is the code snippet:



buttons: [{
text: 'OK',
listeners: {
click: function() {
Ext.Msg.alert("Info", mywindow.modal);
//mywindow.modal = false; has no effect
}
}
}]


Any suggestions?

cougar83
22 Oct 2010, 4:44 AM
Hi Forum,

what can I do, to set the Ext.Window config option modal to false after it is instantiated (with modal: true,). I could ask for the parameter, what is actually set, but I found no chance to alter it.

This is the code snippet:



buttons: [{
text: 'OK',
listeners: {
click: function() {
Ext.Msg.alert("Info", mywindow.modal);
//mywindow.modal = false; has no effect
}
}
}]
Any suggestions?

Condor
22 Oct 2010, 4:50 AM
modal is a read-only property and there is no setModal method, so the only way to know how to undo what modal:true has done is to look at the source (e.g. in Ext.Window.hide).


win.mask.hide();
Ext.getBody().removeClass('x-body-masked');
win.modal = false;

Animal
22 Oct 2010, 4:54 AM
It works:



w = new Ext.Window({
title: 'foo',
height: 100,
width: 100,
renderTo: document.body,
modal: true
});
w.modal = false;
w.show();

cougar83
22 Oct 2010, 5:32 AM
Thank you for your advise. Probably I found a solution (not sure if my changes lead to unpredictable changes ...).

Here is my method in the ext-all-debug.js (3.3.0) within the Ext.Window declaration:



setModalFalse : function() {
this.mask.hide();
Ext.getBody().removeClass('x-body-masked');
this.modal = false;
},


So it is the same code found in the hide function of the source code. Any comments desired.

Condor
22 Oct 2010, 5:35 AM
You still have to set modal to false after that, otherwise the window still thinks it is modal and does some things differently.

Animal
22 Oct 2010, 5:58 AM
This stuff has to change for 4.0.

There should be a single modal mask managed by a WindowMgr instance. It should move it to one z-index below its topmost Window's shadow.

Condor
22 Oct 2010, 6:11 AM
Good. You could create a different WindowMgr for windows that only need to cover part of the interface.

Animal
22 Oct 2010, 6:16 AM
Yes, WindowMgrs could manage windows within a specified element which they are configured with upon construction.

The default one obviously managing the <body> element as it does now.