PDA

View Full Version : modal and system modal dialogs



margozzi
25 Apr 2012, 1:22 PM
As I recall from my Windows programing days ( many moons ago ) there were two types of modal dialogs. System modal disallowed any clicks on the entire application. The other kind allowed you to specify the parent object for the dialog and only the parent was masked and had it's clicks disabled.

I would like a similar functionality in ExtJS. As far as I can tell this does not exist.

Does anyone know if this is possible?

If not, it seems like a useful feature.

scottmartin
26 Apr 2012, 10:08 AM
You may be able to do something like:



Ext.onReady(function(){

var parentWin = Ext.create('Ext.window.Window', {
id: 'parentwin', // dirty access to window for example
title: 'Parent',
height: 200,
width: 400,
items: [{
xtype: 'textfield',
fieldLabel: 'My Text'
}]
}).show();

var childWin = Ext.create('Ext.window.Window', {
id: 'childwin',
title: 'Child',
height: 100,
width: 200,
listeners: {
show: function() {
var pw = Ext.getCmp('parentwin');
pw.getEl().mask();
pw.disable();
},
close: function() {
var pw = Ext.getCmp('parentwin');
pw.enable();
pw.getEl().unmask();
}
}
}).show();

});


You would also need to access the Ext.WindowManager to decide if the parent window could be brought to the front since you can select it to simulate modal.

Regards,
Scott.