PDA

View Full Version : block multiple instances of dialog



prakashkadakol
3 Jul 2012, 3:57 AM
Hi

I have Insert button on click of this will pop up ext js dialog insert form,I wanted to block multiple instances of that form on each click of that button any idea or suggestions for this except disabling that button.

sdt6585
3 Jul 2012, 4:13 AM
You could always save a reference to the element whenever you create it and check it's type before creating another



Ext.define('Ext.data.Controller', {
//constructor & event register...

onButtonClick: function () {
if (typeof this.window === 'undefined' || this.window.isDestroyed === false) {
this.window = Ext.create('Ext.window.Panel', {config: 'object'});
}
}
});


You could also set the modal property of the window to true, that would in effect disable the button by covering it with a big div. Why is it getting created more than once anyway? If you've tried to create, destroy, and subsequently create a controller again, that will double register events and cause that error.