Ext下拉框中的“全部”

来源:互联网 发布:大闹天宫光翼进阶数据 编辑:程序博客网 时间:2024/06/09 19:29

一:

 

 

Ext的Combox数据一般是后台返回的,但是后台返回的,一般不带有全部

 

例如:

后台返回:

上海团队

山东团队

浙江团队

 

前台需求:

全部

上海团队

山东团队

浙江团队

 

二:代码

 

var regionStore = new Ext.data.Store({
   proxy : new Ext.data.HttpProxy({
    api : {
     read : 'remoteAction!getPage.action'
    }
   }),
   reader : new Ext.data.JsonReader({
    totalProperty : 'total',
    root : 'data'
   }, [ {
    name : 'regionId',
    mapping : 'REGION_ID'
   }, {
    name : 'regionDesc',
    mapping : 'REGION_DESC'
   } ]),
   listeners : {
    load : function() {
     var r = new regionStore.recordType({
      regionId : '-1',
      regionDesc : '全部'
     });
     regionStore.insert(0, r);

    //设置combox选中全部
     
Ext.getCmp('id_region_combobox').setValue('-1');
    }
   },
   autoSave : false
  });