PDA

View Full Version : Focus on OK button in MessageBox



CraigMyers
27 Jan 2012, 6:49 AM
I'm trying to get the OK button in the MessageBox to get focus by default

see code below:


Ext.Msg.show({
buttons: Ext.Msg.OKCANCEL,
icon: Ext.Msg.INFO,
defaultFocus: 'ok'
});


somehow is does not receive focus when using defaultFocus property
i've tried all kind of defaultFocus allowed properties

please help!

27 Jan 2012, 1:47 PM
This works in the alert, confirm dialogs. Sounds like a bug. Are you using 4.0.7? I can reproduce this issue in that version. If so, please report it in the bug forums.

CraigMyers
29 Jan 2012, 11:59 PM
I'm using 4.1 beta 2.

sean.parmelee
24 Apr 2012, 11:04 AM
I had a similar issue where I was displaying the Yes and No buttons, but wanted No to be focused by default. I had to set the defaultButton property prior to calling show:



Ext.Msg.defaultButton = 'no';
Ext.Msg.show({
buttons: Ext.Msg.YESNO,
icon: Ext.Msg.QUESTION
});