Javascript 未捕获的TypeError:无法读取null的属性“addCls”

Javascript 未捕获的TypeError:无法读取null的属性“addCls”,javascript,extjs4.2,Javascript,Extjs4.2,守则如下: 我知道错误是因为这条线- record.set("units",newVal); 但我不知道到底是什么问题。 代码在这里- Ext.onReady(function(){ Ext.require([ 'Ext.ux.CheckColumn']); Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['name', 'email', 'u

守则如下: 我知道错误是因为这条线-

    record.set("units",newVal);
但我不知道到底是什么问题。 代码在这里-

    Ext.onReady(function(){

    Ext.require([ 'Ext.ux.CheckColumn']);


   Ext.create('Ext.data.Store', {
         storeId:'simpsonsStore',
         fields:['name', 'email', 'units', 'unitInformation'],
         data:{'items':[
      { 'check':false,'name': 'Lisa',   "units":"555-111-1224" , "unitInformation":"a,b,c,d" },
      { 'check':false,'name': 'Bart',   "units":"555-222-1234",  "unitInformation":"a,b,c,d"  },
      { 'check':false,'name': 'Homer',  "units":"555-222-1244", "unitInformation":"a,b,c,d"   },
      { 'check':false,'name': 'Marge',  "units":"555-222-1254" , "unitInformation":"a,b,c,d"  }
  ]},
  proxy: {
      type: 'memory',
      reader: {
          type: 'json',
          root: 'items'
      }
  }
 });

     var grid = Ext.create('Ext.grid.Panel', {
  title: 'Simpsons',
  renderTo: Ext.getBody(),
  tbar: [
    { xtype: 'button', text: 'Button 1',
      handler: function(btn){
        console.log(grid.getStore().getUpdatedRecords());
      }
    }
  ],
  store: Ext.data.StoreManager.lookup('simpsonsStore'),
  viewConfig: {markDirty: false},
  columns: [
      {
        xtype:'checkcolumn' ,id:'check',dataIndex:'check', text:'Select',
        listeners:{
          checkchange:function(checkbox, rowIndex, checked, eOpts){
            if(checked==true){
              this.up('grid').getView().getRecord(rowIndex).dirty=true;
            }
          } 
        }
      },
      { text: 'Name',  dataIndex: 'name' ,       flex : 1,},
      {
        text : 'Units',
        flex : 1,
        dataIndex : 'units',
        xtype: 'componentcolumn',
        renderer: function(value, m, record) { 
          record.dirty=false;
          if(record.get('unitInformation')==='')    
            return '';
            return {
              listeners : {
                change: function(combo,newVal,oldVal,opts) {
                  record.set("units",newVal);
                  if(record.get('check')==true)
                    record.dirty=true;
                  else
                    record.dirty=false;
                }
              },
              store: record.get('unitInformation').split(","), 
                value: value, 
                xtype: 'combobox' 
            };
          }
        }],
  buttons:[{
      text:'Create Button',
      handler:function(btn){

        var records=grid.getStore().getUpdatedRecords();
        for(i=0;i<records.length;i++){
        alert(records[i].get('name'));
        alert(records[i].get('units'));
        var s=records[i].get('name')+','+records[i].get('units');
        alert(s);
    }
      }


   }],


 });


   Ext.create('Ext.container.Viewport', {
      renderTo: Ext.getBody(),  
      items: [
     {
      width:600,
      height:500,
      layout:'fit',
      items:[grid
      ]
    }
  ]
});
});

错误并不是因为那一行。我注释了那一行,然后eror就消失了。您可以在渲染器中添加alertrecord,只是为了检查记录是否真的未定义。我想您对网格对象有问题是的,它是定义的。应用程序运行良好。此错误仅在控制台中出现。它不影响功能。我只是想知道这个错误是怎么回事。我想这可能是一个内部错误。