Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight default button in ExtJS (3.x) MessageBox

is there an Ext-sanctioned way to highlight the default button (the one triggered by pressing Enter) in Ext.MessageBox?

Please note that I do not want to do that by focusing the button when the MessageBox is shown (in case of a "prompt" dialog I want the input element to have focus).

I know I can do that by adding a custom class to the button element but ... maybe there is a better and more Ext-like way of doing this?

Thanks.

like image 518
Sergio Avatar asked Jun 19 '11 16:06

Sergio


1 Answers

In ExtJs 4 you can set the default button as follows:

Ext.MessageBox.defaultButton = buttonIndex;

Where 'buttonIndex' is the index of the button on the dialog. You need to do this before you call Ext.MessageBox.Show.

like image 132
Rohland Avatar answered Sep 29 '22 07:09

Rohland