无论我用本地store 还是远程store 都无法显示combo的候选值,下拉都是空的
本地Store代码如下:                                        xtype:'combo',
id:'sexCombo',
mode:'local',//数据填充模式,分为local和remote两种模式,默认为remote
displayField:'sex',//绑定显示store里定义的sex
readOnly:true,
triggerAction:'all',//combo中显示所有的数据;还有一个query,只显示选中的。
value:'男',
store:new Ext.data.SimpleStore({
fields:['type','sex'],
data:[[0,'男'],[1,'女']]
})代码如下: var store = new Ext.data.Store
        ({
                proxy: new Ext.data.HttpProxy({url:'usergroup.do?method=getAllUserGroup'}), // 数据源                
                reader: new Ext.data.JsonReader({totalProperty:"totalPorperty",root:'usergroup',fields:[{name: 'UGDsplayName'},{name: 'ugId'}]})// 如何解析
        });       
    store.load({params:{start:0,limit:6}});
//Simple 'border layout' panel to house both grids
    var aaaaa = new Ext.Panel({
      title:'UserGroup',
      id:'system-ug-panel',
      height   : 200,
      region : 'north',
      enableTabScroll : true,
 split : true,
 layout:'form',
 autoScroll : true,
     collapseMode : 'mini',// 在分割线处出现按钮
 collapsible : true,
 collapsed : false,// 默认收缩
 items:new Ext.form.ComboBox
        ({     
            tpl: '<tpl for="."><div ext:qtip="提示:ID={ID};TypeCName={TypeCName}" class="x-combo-list-item">{TypeCName}</div></tpl>',
            id:"ComboBox_ID",
            editable:true,
              store:store,
            emptyText:'请选择',
            mode: 'remote'
            typeAhead: true,
            triggerAction: 'all',
            valueField:'ugId',  
            displayField:'UGDsplayName',
            width:240,
            border:true,
            frame:true,
            resizable:true,
            pageSize:6         
        })
    });
Store请求JSON数据如下:{'usergroup':[
  {
  "UGDsplayName": "管理员",
  "makeDate":   {
   "nanos": 0,
   "time": 1229011200000,
   "minutes": 0,
   "seconds": 0,
   "hours": 0,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 5,
   "date": 12
  },
  "ugId": 1,
  "UGCode": "admin",
  "modyDate":   {
   "nanos": 0,
   "time": 1229011200000,
   "minutes": 0,
   "seconds": 0,
   "hours": 0,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 5,
   "date": 12
  }
 },
  {
  "UGDsplayName": "操作员",
  "makeDate":   {
   "nanos": 0,
   "time": 1229875200000,
   "minutes": 0,
   "seconds": 0,
   "hours": 0,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 1,
   "date": 22
  },
  "ugId": 2,
  "UGCode": "option",
  "modyDate":   {
   "nanos": 0,
   "time": 1229875200000,
   "minutes": 0,
   "seconds": 0,
   "hours": 0,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 1,
   "date": 22
  }
 },
  {
  "UGDsplayName": "未登陆",
  "makeDate":   {
   "nanos": 0,
   "time": 1230692559000,
   "minutes": 2,
   "seconds": 39,
   "hours": 11,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 3,
   "date": 31
  },
  "ugId": 3,
  "UGCode": "guest",
  "modyDate":   {
   "nanos": 0,
   "time": 1230692562000,
   "minutes": 2,
   "seconds": 42,
   "hours": 11,
   "month": 11,
   "timezoneOffset": -480,
   "year": 108,
   "day": 3,
   "date": 31
  }
 }
]}
我是通过eval动态加载的包含这个combo的js文件,其他组件都很正常,combo就是不行。
js是通过如下加载实例化: if (currentIndex == num - 1) { this[node.id] = eval(jsStr); model = new this[node.id]();
   }
谢谢帮我解决这个问题,可加分。。

解决方案 »

  1.   

    eval不是万能的,可能会存在作用域的闭包问题
      

  2.   


      你把 Store 换成 JsonStore ,fileds 中换成fields:['UGDsplayName','ugId'] 再用2.2试试
     var store = new Ext.data.JsonStore
       ({
          proxy: new Ext.data.HttpProxy({url:'usergroup.do?method=getAllUserGroup'}), // 数据源                
           reader: new Ext.data.JsonReader({
                          totalProperty:"totalPorperty",
                          root:'usergroup',
                          fields:['UGDsplayName','ugId']
                   })// 如何解析
        });  
      

  3.   

    本地的simplestore都构建不了
    郁闷死了
      

  4.   


    这到底是什么原因导致的呢?
    这样做的话,simplestore也还是不行
      

  5.   

    先试下这样的写法,我也是动态加载JS的,没出现过你所说的情况,我用的是2.O。明天再把我的代码贴给你                    xtype:'combo',
                        id:'sexCombo',
                        //mode:'local',//数据填充模式,分为local和remote两种模式,默认为remote
                        displayField:'sex',//绑定显示store里定义的sex
                        readOnly:true,
                        //triggerAction:'all',//combo中显示所有的数据;还有一个query,只显示选中的。
                        value:'男',
                        store:new Ext.data.SimpleStore({
                            fields:['sex'],
                            data:[['男'],['女']]
                        })
    只留下最小的属性配置和最简单的数据测试看看
      

  6.   

    在extjs 官方 似乎有人报这个是bug
    ...