zoukankan      html  css  js  c++  java
  • Extjs4---Cannot read property 'addCls' of null 或者 el is null 关于tab关闭后再打开不显示或者报错

    做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错

    我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCls' of null,

    原因是我在定义grid的错误

    这是错误代码:

    [javascript] view plaincopy
     
    1. Ext.define('HT.view.Grid',{  
    2.     extend:'Ext.grid.Panel',  
    3.   
    4.     title : '人员列表',  
    5.     400,  
    6.     height:170,  
    7.     frame:true,  
    8.     store: {  
    9.         fields: ['id','name','sex','age','birthday'],  
    10.         proxy: {  
    11.             type: 'ajax',  
    12.             url : 'users',  
    13.             reader: {  
    14.                 type: 'json',//Ext.data.reader.Json解析器  
    15.                 root: 'users'  
    16.             }  
    17.         },  
    18.         autoLoad: true  
    19.     },  
    20.     columns: [//配置表格列  
    21.         new Ext.grid.RowNumberer(),//表格行号组件  
    22.         {header: "编号",  80, dataIndex: 'id', sortable: true},  
    23.         {header: "姓名",  80, dataIndex: 'name', sortable: true},  
    24.         {header: "年龄",  80, dataIndex: 'age', sortable: true},  
    25.         {header: "性别",  80, dataIndex: 'sex', sortable: true},  
    26.         {header: "生日",  80, dataIndex: 'birthdate', sortable: true}  
    27.     ]  
    28.   
    29. });  


    应该改为这个:

    [javascript] view plaincopy
     
    1. Ext.define('HT.view.Grid',{  
    2.     extend:'Ext.grid.Panel',  
    3.     title : '人员列表',  
    4.       
    5.     initComponent:function(){  
    6.         Ext.apply(this,{  
    7.             400,  
    8.             height:170,  
    9.             frame:true,  
    10.             store: {  
    11.                 fields: ['id','name','sex','age','birthday'],  
    12.                 proxy: {  
    13.                     type: 'ajax',  
    14.                     url : 'users',  
    15.                     reader: {  
    16.                         type: 'json',//Ext.data.reader.Json解析器  
    17.                         root: 'users'  
    18.                     }  
    19.                 },  
    20.                 autoLoad: true  
    21.             },  
    22.             columns: [//配置表格列  
    23.                 new Ext.grid.RowNumberer(),//表格行号组件  
    24.                 {header: "编号",  80, dataIndex: 'id', sortable: true},  
    25.                 {header: "姓名",  80, dataIndex: 'name', sortable: true},  
    26.                 {header: "年龄",  80, dataIndex: 'age', sortable: true},  
    27.                 {header: "性别",  80, dataIndex: 'sex', sortable: true},  
    28.                 {header: "生日",  80, dataIndex: 'birthdate', sortable: true}  
    29.             ]  
    30.         }),  
    31.         this.callParent(arguments);  
    32.     }  
    33.   
    34. });  

    看样子属性的设置都要用apply方法设置进去,nnd,这个问题整了两天,终于解决了

  • 相关阅读:
    关于quartusII 错误 Error: Current license file does not support the EP*** device 错误原因总结
    怎样用delphi关闭并重新启动 explorer.exe进程
    SQL创建链接服务器
    C#服务启动以及服务指令
    底部广告弹出
    选项卡
    tab切换
    pagex/y offsetx/y screenx/y clientx/y 用法及区别
    放大镜jQuery效果
    放大镜js实现效果
  • 原文地址:https://www.cnblogs.com/smiler/p/3146342.html
Copyright © 2011-2022 走看看