How to set the default value and value of extjs ComboBox

Source: Internet
Author: User

 

 

It is mainly to listen to the load event in the store. When the store is complete, the data has been referenced. Obtain the first record of the store and set it to the default value of ComboBox.

VaR poststore = ext. Create ('ext. Data. store ',{
Model: 'state ',
Listeners :{
Load: function (){
VaR record = poststore. getat (0). Get ('position _ id ');
Selectpostion. setvalue (record );
}
},
Proxy: New Ext. Data. httpproxy ({URL: '/web/wage/ajaxcityconfig. aspx? Type = pos '}),
Reader: New Ext. Data. jsonreader ({},[
{Name: 'position _ id '},
{Name: 'position '}
])

});

 

// ComboBox with multiple selection Enabled
VaR selectpostion = ext. Create ('ext. Form. Field. combobox ',{
Fieldlabel: 'select A position ',
Labelstyle: 'width: 80px; color: Black ',
Style: 'color: Black ',
Multiselect: false,
Displayfield: 'position ',
Value :'',
Width: 320,
Labelwidth: 80,
Valuefield: 'position _ id ',
Store: poststore,

Querymode: 'remote'
});

Poststore. Load ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.