Reputation: 49
I'm trying to show display field value in the combo instead of empty text value. How can I achieve this? Data is populated in combo through local server. I have tried to implement a listener, but there's no change in output.
listener: {
beforeRender:function(boxs1) {
//if(!this.allowBlank) {
var r1 = findRecordByDisplay(CIVIL) ;
Ext.getCmp('boxs1').setValue(fullName);
//}
}
}
Upvotes: 1
Views: 4228
Reputation: 534
you have to know
setRawValue() => displayField
setValue() => valueField
Upvotes: 0
Reputation: 643
Use render or afterrender event to set the value.
listener:{
afterrender:function(boxs1){
//if(!this.allowBlank){
var r1 = findRecordByDisplay(CIVIL) ;
Ext.getCmp('boxs1').setValue(fullName);
//}
}
}
Upvotes: 0
Reputation: 643
please try this:
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.namespace('Ext.exampledata');
Ext.exampledata.zone = [
['us', 'US', 'US Zone'],
['japan', 'JAPAN', 'Japan Zone'],
['eu', 'EUROPE', 'Europe Zone']
];
var test= new Ext.form.ComboBox({
id:'appwarpZoneId',
fieldLabel: 'Zone',
hiddenName:'zone',
renderTo:'sid',
store: new Ext.data.ArrayStore({
fields: ['abbr', 'zone'],
data : Ext.exampledata.zone
}),
valueField:'abbr',
value:'us',
emptyText : 'Please Select ...',
displayField:'zone',
typeAhead: true,
mode: 'local',
editable:false,
triggerAction: 'all',
selectOnFocus:true,
anchor: '25%'
})
});
Upvotes: 1