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 ();