ext2 Ext.form.ComboBox 远程加载数据 mode:'remote',

var lectordata=new Ext.data.Store({///列表框中的选项数据
   proxy: new Ext.data.HttpProxy({url:'manage/lect.action?actType=lectorList'}),//获取json数据得地址
   reader: new Ext.data.JsonReader({},['id','text'])
  });
  //lectordata.load();//不能写(现在还不时加载得时候)

     var form = new Ext.form.FormPanel({
         id:'myform',
         labelAlign:'top',
         bodyStyle:'padding:5px',
         width: 500,
         fileUpload:true,
          items: [{
                xtype:'combo',
                hiddenName:"ltorSex",

                id:"lsexBox",
                fieldLabel:'<span style="color:red">添加讲师</span>',
                store:lectordata,
                typeAhead: true,
                editable:true,
                valueField:"id",
                displayField:"text",
                mode:'remote',
                minChars:1,//默认时4

                queryDelay : 500,//500毫秒,且字大于等于1个时到服务器中去查询。

                emptyText:"添加讲师",
                allowBlank:false
        }]
  });

/////////////////////////////////////////////////////////////////

其中:manage/lect.action?actType=lectorList返回json数据为:

[{"id":1,"text":"江振东"},{"id":2,"text":"黄著"},{"id":3,"text":"江卫东"},{"id":4,"text":"贾涵清"}]

 

输入一(minChars:1)个以上得字就能返回上面四个选项

你可能感兴趣的:(ext2 Ext.form.ComboBox 远程加载数据 mode:'remote',)