EXTJS combo动态加载 默认初始值

 var combo = new Ext.form.ComboBox({
  store : store,
  valueField : "id",
  displayField : "name",
  editable : false,
  allowBlank : false,
  blankText : "请选择",
  name : 'rechargeType',
  id : 'rechargeType',
  triggerAction : 'all',
  hiddenName : 'rechargeTypeIdKey',
  width : 150
 });

 

var store = new Ext.data.JsonStore({
  autoDestroy : true,
  url : '',
  storeId : 'comboCardTypeStore',
  root : 'typeList',
  idProperty : 'typeId',
  fields : ['name', 'id'],
  listeners : {
   load : function(store, record, opts) {
    var combo = Ext.getCmp('rechargeType');
    combo.setValue(record[0].data.typeId);
    combo.setRawValue(record[0].data.typeName)
   }
  }
 });

store.load();

你可能感兴趣的:(ExtJs)