Extjs4---Cannot read property 'addCls' of null 或者 el is null 关于tab关闭后再打开不显示或者报错
做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错
我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCls' of null,
原因是我在定义grid的错误
这是错误代码:
- Ext.define('HT.view.Grid',{
- extend:'Ext.grid.Panel',
- title : '人员列表',
- width:400,
- height:170,
- frame:true,
- store: {
- fields: ['id','name','sex','age','birthday'],
- proxy: {
- type: 'ajax',
- url : 'users',
- reader: {
- type: 'json',//Ext.data.reader.Json解析器
- root: 'users'
- }
- },
- autoLoad: true
- },
- columns: [//配置表格列
- new Ext.grid.RowNumberer(),//表格行号组件
- {header: "编号", width: 80, dataIndex: 'id', sortable: true},
- {header: "姓名", width: 80, dataIndex: 'name', sortable: true},
- {header: "年龄", width: 80, dataIndex: 'age', sortable: true},
- {header: "性别", width: 80, dataIndex: 'sex', sortable: true},
- {header: "生日", width: 80, dataIndex: 'birthdate', sortable: true}
- ]
- });
应该改为这个:
- Ext.define('HT.view.Grid',{
- extend:'Ext.grid.Panel',
- title : '人员列表',
- initComponent:function(){
- Ext.apply(this,{
- width:400,
- height:170,
- frame:true,
- store: {
- fields: ['id','name','sex','age','birthday'],
- proxy: {
- type: 'ajax',
- url : 'users',
- reader: {
- type: 'json',//Ext.data.reader.Json解析器
- root: 'users'
- }
- },
- autoLoad: true
- },
- columns: [//配置表格列
- new Ext.grid.RowNumberer(),//表格行号组件
- {header: "编号", width: 80, dataIndex: 'id', sortable: true},
- {header: "姓名", width: 80, dataIndex: 'name', sortable: true},
- {header: "年龄", width: 80, dataIndex: 'age', sortable: true},
- {header: "性别", width: 80, dataIndex: 'sex', sortable: true},
- {header: "生日", width: 80, dataIndex: 'birthdate', sortable: true}
- ]
- }),
- this.callParent(arguments);
- }
- });
看样子属性的设置都要用apply方法设置进去,nnd,这个问题整了两天,终于解决了
Extjs4---Cannot read property 'addCls' of null 或者 el is null 关于tab关闭后再打开不显示或者报错的更多相关文章
- Extjs4---Cannot read property 'addCls' of null
用MVC做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错 我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCl ...
- mysql设置text字段为not null,并且没有默认值,插入报错:doesn't have a default value
一.问题描述 在往数据库写入数据的时候,报错: '字段名' doesn't have a default value 本来这个错误是经常见到的,无非就是字段没有设置默认值造成的.奇怪的是,我这边报错的 ...
- Extjs4---Cannot read property 'addCls' of null - heirenheiren的专栏 - 博客频道 - CSDN.NET
body { font-family: 微软雅黑,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLi ...
- js执行函数报错Cannot set property 'value' of null怎么解决?
js执行函数报错Cannot set property 'value' of null 的解决方案: 原因:dom还没有完全加载 第一步:所以js建议放在body下面执行, 第二步:window.on ...
- hexo 报错 Cannot read property 'replace' of null
详细错误信息: FATAL Cannot read property 'replace' of null TypeError: Cannot read property 'replace' of nu ...
- Hexo server报错TypeError: Cannot read property 'utcOffset' of null解决方法
最近刚刚开始使用Hexo,新建了一篇article,运行hexo server时候总是报错Cannot read property 'offset' of null. 最后发现是因为手贱把_confi ...
- jquery easyui datagrid 空白条处理 自适应宽高 格式化函数formmater 初始化时会报错 cannot read property 'width'||'length' of null|undefined
1---表格定义好之后右侧可能会有一个空白条 这个空白条是留给滚动条的,当表格中的一页的数据在页面中不能全显示时会自动出现滚动条,网上有很多事要改源码才可以修改这个,但是当项目中多处用到时,有的需要滚 ...
- 解决sweetalert 无故报错 elem.className.replace Uncaught TypeError: Cannot read property 'className' of null
今天碰到这么一个问题,在使用sweetalert的时候时有时无会报错 elem.className.replace Uncaught TypeError: Cannot read property ' ...
- 报错”Cannot read property 'addEventListener' of null“
1.报错:Cannot read property 'addEventListener' of null 2.解决方案: 把代码放到window.onload=function(){...}里面,因为 ...
随机推荐
- C#sealed和final
sealed用于类时,该类被称为密封类,密封类不能被继承: C#提出了密封方法(sealed method) 的概念,以防止在方法所在类的派生类中对该方法的重载.对方法可以使用sealed 修饰符,这 ...
- boost-字符文本处理
1.lexical_cast 一些常见的数值,字符互转函数: 整型int: itoa()._itoa_s atoi()._ttoi 无符号整型unsigned int: _ultoa_s()._ult ...
- 2019swpuj2ee作业一:C/S,B/S的应用的区别
1.硬件环境不同: C/S 一般建立在专用的网络上, 小范围里的网络环境, 局域网之间再通过专门服务器提供连接和数据交换服务.B/S 建立在广域网之上的, 不必是专门的网络硬件环境,例与电话上网, ...
- subarray sum
public class Solution { /* * @param nums: A list of integers * @return: A list of integers includes ...
- PgAgent安装、配置、运行
一 安装cmakewget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gztar -zxvf cmake-2.8.5.tar.gzcd /root ...
- 安装VS2017后打开项目提示 asp.net 4.0尚未web服务器注册
Visual Studio 2017 出来了,手痒安装完成后打开原来的项目缺提示,asp.net 4.0尚未web服务器注册.郁闷了… 按照提示的方法,如何:将 ASP.NET Web 应用程序升级到 ...
- idea集成maven
1 下载maven并解压 至 http://archive.apache.org/dist/maven/maven-3/下载zip包,下载后的包如下: 解压到安装目录下:如:D:\software,解 ...
- javascript事件循环
js单线程 js是单线程的,这样更有利与用户交互以及DOM操作;有关进程与线程的详细解释可以点击传送门:尽管webworker可以实现多线程,但本质上他还属于单线程,由webworker创建的线程都由 ...
- DefaultServlet
在web访问任何资源都是在访问Servlet 当你启动Tomcat,你在网址上输入http://localhost:8080.为什么会出现Tomcat小猫的页面? 这是由缺省Servlet为你服务的! ...
- python语法基础-初始化/继承
写了一些程序,基本上都是直接def函数 然后在main方法中 调用 但是在一些应用程序中 会有基本语法的使用(初始化,继承) 初始化: 1.在程序执行时一定执行一次的操作 2.python中初始化in ...