ext ComboBox

var store=new Ext.data.Store({
   proxy: new Ext.data.HttpProxy(
           url:"xxx.txt",
          ),
   reader: new Ext.data.ArrayReader(
          {},
          [
            {name:'value'},
            {name:'text'}
          ]
         )
});
 store.load();
 
var combo=new Ext.form.ComboBox({
       store:store,
       emptyText:'选择',
       mode:'local',
       //mode:'remote',如果设置此项,又使用store.load();store就会读取两次数据
       triggerAction:'all',
       valueField:'value',
       displayField:'text'
     });

高级配置:
minListWidth:220,
        pageSize:5,
        resizable:true  //弹出列表拖放,进而修改列表大小
//注:分页必须参数mode比为remote,否则没有效果


监听:
combo.on("select",function(comboBox){
     alert(comboBox.getValue+'-'+comboBox.getRawValue());
})
============================================================================================================

你可能感兴趣的:(ext)