Extjs 4:无法看到组合框的动态数据

时间:2013-02-02 18:18:24

标签: extjs

我正在尝试在网格中呈现可编辑的组合。以下是我的代码段

columns: [
         {
             text     : 'Account Name',
             name      : 'accountName', 
             width     : 80,    
             flex     : 4,                                      
             sortable : true,
             dataIndex: 'accountName'
          },
          {
             text     : 'Account Number',
                 name      : 'accountNumber',
             flex     : 2,                                        
             sortable : false,                               
             dataIndex: 'accountNumber',
             editor      : {'combobox',
                     typeAhead       : true,
                     selectOnTab     : true,
                     lazyRender      : true,
                     triggerAction   : 'all',
                     listClass       : 'x-combo-list-small',
                      queryMode       : 'local',
                      store           : emptyStore,

            },                                              

                    displayField    : 'acctNumber',
                    valueField      : 'acctNumber',
                    listeners: {
                            afterrender: function(comboField, eOpts)
                             {
                                // have to add two sub accounts - 1. account number of column 2.account number of column + "1" 
                               // first try with hard coded values
          var employeesStore = new Ext.data.ArrayStore({

          fields:['acctNumber'],
          data:[{acctNumber: '123456'},{acctNumber: '23456'}]
          })

         comboField.bindStore(employeesStore);
            }  
           }

         }



      },

但是,当我跑步时,我得到了两个空行的下拉

有人可以帮助我吗?

由于 Tharahan

1 个答案:

答案 0 :(得分:0)

这样做的原因是因为列上的dataIndex不会映射到绑定到网格的商店中的任何字段。如果您将dataIndex: 'accountNumber'更改为dataIndex: 'acctNumber',则会看到数据。此外,您在商店中没有绑定到网格的“accountName”字段,因此在向商店添加字段(和相应数据)之前,您将看不到任何数据。