EXTJS-->下拉框

var suppStore = new Ext.data.Store({
            //autoLoad: true,
            proxy : new Ext.data.HttpProxy({
            url : rootPath+"basedata/supplierInfo!getSuppliers.action",
               timeout : 60000
            }),
            reader : new Ext.data.JsonReader({
            root : 'list' ---后台返回的JSON数据含有list在这里进行解析
            },
Ext.data.Record.create([ -->创建一个record,一条记录
{ name : 'C_SUPPLIER_CODE'}, -->可以用来隐藏ID
{ name : 'C_SUPPLIER_NAME'} -->用来显示
]))

           });

suppStore.load({ -->插入第一条数据,显示全部
            callback: function(obj){
suppStore.insert(0,new suppStore.recordType({C_SUPPLIER_CODE:'',C_SUPPLIER_NAME:'全部'}));
}
           });


var  supp_Comb = new Ext.form.ComboBox({
typeAhead : true,
loadStatus : false,
triggerAction : 'all',
-->用all标识把下拉框列表值全部显示出来,如果用query,做了一次选择之后,第二次去使用 会按第一次输入的值显示

store : suppStore,
fieldLabel : '代理商',
id: _this.formId+'supp',
name : 'supp',
allowBlank : false,
editable : false,
mode : 'local',
displayField : 'C_SUPPLIER_NAME',
-->用来显示的数据

valueField : 'C_SUPPLIER_CODE', -->值是ID
resizable : true,
editable : false,
width : _this.textwidth,
selectOnFocus : true
});

猜你喜欢

转载自blog.csdn.net/u014249790/article/details/43167597
今日推荐