Ext.form.ComboBox默认选中
1.静态数据
var data1 = [];//静态数据
var combo1 = new Ext.form.ComboBox({
???store: new Ext.data.SimpleStore({
?? ??fields: ['id','name'],? data: [],
?? ??listeners: {
?? ???load: function(store, records, options){
?? ????if(records.length > 0){
???????combo1.setValue(records[0].get(combo1.valueField));
??????}
?? ???}
?? ??}
?? ?}),
?? ?displayField: 'name',valueField: 'id',mode: 'local',width:'200',
?? ?hiddenName:'bean.proType',fieldLabel: '类别',allowBlank: false,
???editable: false,hideTrigger:false,selectOnFocus: true,triggerAction: 'all'
???? });
combo1.getStore().loadData(data1);
?
2.动态数据
var combo2 = new Ext.form.ComboBox({
???store: new Ext.data.SimpleStore({
?? ??fields: ['id','name'],autoLoad:true,
????proxy: new Ext.data.HttpProxy({ url: 'app/listRebate4Combo.do' }),
????listeners: {
?????load: function (store,records,options){
??????if(records.length > 0){
???????combo2.setValue(records[0].get(combo2.valueField));
??????}
?????}
????}
?? ?}),
?? ?displayField: 'name',valueField: 'id',mode: 'local',width:'200',
?? ?hiddenName:'bean.isSale',fieldLabel: '折扣',
???editable: false,hideTrigger:false,selectOnFocus: true,triggerAction: 'all'
???? });
?
?
?
?
?
?
?
?