Select first record of the combo-box in ExtJS

Many times we have requirement where we want to select the first record by default in a combo-box.

For this, when the combo-box renders then run this code

// function to give the combobox a default value
 Ext.getStore('StoreName').on('load',function(store) {
    var combo = Ext.getCmp('combo_box_id');
    combo.select(combo.getStore().getAt(0));
 });

Happy Coding. 🙂

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s