给Ext.form.ComboBox设置默认选中某项

来源:互联网 发布:法尔奈斯庄园赏析知乎 编辑:程序博客网 时间:2024/06/07 19:25
this.textFld = new Ext.form.ComboBox({
   id:'sComboBox',
   typeAhead: true,
   triggerAction: 'all',
   emptyText:'请选择',
   mode: 'local',
   editable: false,
   store: new Ext.data.SimpleStore({
       fields: ['val','text'],
       data: [[70,'70 公里'], [80,'80 公里'], [90,'90 公里'], [100,'100 公里']]
   }),
   valueField:'val',
   displayField: 'text'
}); 

Ext.getCmp("sComboBox").setValue(80);

红色文字部分必须对应

运行效果:网页加载后,默认选中'80 公里'这项

获取值(转):

combo.getValue() -> the valueField
combo.getRawValue() -> the displayField

原创粉丝点击