ExtJS setting focus in a window

I needed to set the focus to a field in an Ext.Window that contains a FormPanel. Turns out to be really simple, even though it took me awhile to find it…. use the defaultButton config on Ext.Window. It is poorly named, b/c it can be any component, not just a button.

Ext JS 4 Update

Looks like defaultButton is gone and now Ext.window.Window has the more helpfully named field “defaultFocus”.  And, straight from the docs:

Specifies a Component to receive focus when this Window is focused.

This may be one of:


One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s