PDA

View Full Version : FX to close Dialog / MessageBoxes?



rberger
1 Sep 2007, 12:04 AM
I am wondering how to do an FX fadeOut on an Ext.Msg dialog. I've tried:


var msg = Ext.Msg.show({
title: 'notice',
msg: result.responseText,
modal: false,
maxWidth: 300
});

var msg_el = msg.getDialog().getEl();

msg_el.fadeOut({
duration: 1
});



That works nicely except the shadow divs are left behind so I have a "hole" in my display.
See attached screenshot (the shadow at the bottom stays there after the Msg box has faded away)

I saw an earlier posting by Jack (http://extjs.com/forum/showthread.php?t=2515) saying that this would be fixed at some point, just wondering if I need to do something special to make this work?

Thanks!
Rob

Animal
1 Sep 2007, 12:39 AM
BasicDialog does not support this.

http://extjs.com/deploy/ext/docs/output/Ext.BasicDialog.html

Picking an Element and fading it out is up to you. That the BasicDialog's shadow remains is not a bug that needs fixing. You haven't asked the Dialog to hide - you've unilaterally hidden one of the Elements that BasicDialog manages.

You could add a fade method to BasicDialog's prototype if you read the source, and found out how to manage all BasicDialog's managed Elements.

Animal
1 Sep 2007, 12:47 AM
Try



Ext.override(Ext.BasicDialog, {
fade : function(d){
if(this.shadow){
this.shadow.hide();
}
this.el.fadeOut({
duration: d,
callback: this.hide.createDelegate(this)
});
return this;
}
});


And call that on the dialog.