PDA

View Full Version : Change style of Mesagebox's button



varunach
3 May 2011, 1:36 AM
Hi,

Is there a way in which I can change the styling of a Message box's buttons? Example, place a icon, increase site etc.. ?

Thanks.

mitchellsimoens
3 May 2011, 4:31 AM
Ext.MessageBox.show({
....
buttons: [
{ text : 'Test', iconCls : 'someCSS', scale : 'large' } //look at Button API for configs
]
});

varunach
18 May 2011, 10:42 PM
Nope.. this doesn't work. It doesn't show any buttons now.. From the api :


A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo', cancel:'Bar'}), or false to not show any buttons (defaults to false)
I think it's not able to recognize the config, hence defaulting to false. I checked out the code and came up with this:

From ext-all-debug (Ext JS 3.3.1) Ext.Messagebox:


var bs = opt.buttons;
var db = null;
if(bs && bs.ok){ //bs.ok comes as undefined. Hence no button is added. This also means that we can't add any CSS to the buttons since they are predefined
db = buttons["ok"];
}else if(bs && bs.yes){ //bs.yes comes as undefined too.. Hence no button is added. This also means that we can't add any CSS to the buttons since they are predefined
db = buttons["yes"];
}
if (db){
d.focusEl = db;
}

Maybe this can be added as a feature in the next version of Ext JS.