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(){...}里面,因为 ...
随机推荐
- 第38章:MongoDB-集群--Replica Sets(副本集)---多机的搭建
①机器环境 182.48.115.236 master-node(主节点) 182.48.115.237 slave-node1(从节点) 182.48.115.238 slave- ...
- GitHub上好的Java项目
1. java-design-patterns(Star:36k)Github地址:https://github.com/iluwatar/java-design-patterns 介绍:设计模式是形 ...
- .NET 4.0中的泛型逆变和协变
转载自:http://www.cnblogs.com/Ninputer/archive/2008/11/22/generic_covariant.html:自己加了一些理解 随Visual Studi ...
- 02-jQuery的选择器
我们以前在CSS中学习的选择器有: 今天来学习一下jQuery 选择器. jQuery选择器是jQuery强大的体现,它提供了一组方法,让我们更加方便的获取到页面中的元素. 1.jQuery 的基本选 ...
- Codeforces Round #514 (Div. 2) B - Forgery
这个题我一开始没思路,最后也没思路 2个小时一直没思路 本来还想解释题意的,写了半天发现解释的不是很清楚,你还是google翻译一下吧 这个题解法是这样的: 首先,给你图案里面有很多的点,每个点的周围 ...
- 我知道的nginx配置
1.nginx配置文件 2.配置访问域名 #京淘商品管理系统 server { listen 80; server_name manage.jt.com; location / { proxy_pas ...
- 使用TheFolderSpy监控文件夹的变化-邮件通知
一.概述 当我们的文档或者代码文件发布在公网.共享文件夹中,其他用户具备访问或修改的权限时,就存在文档被覆盖或删除的分享.另外一个典型的场景,发布在Web服务器上的网页文件,在网站版本不更新的时间,服 ...
- React Native学习方法论
这是我技术公众号的第一篇文章,也是React Native系列文章的第一篇,对我的文章感兴趣的可以加我微信16230091进行关注. 本文表面上讲React Native(以下简称RN),实际上对于学 ...
- Lerning Entity Framework 6 ------ Handling concurrency With SQL Server Database
The default Way to handle concurrency of Entity Framework is using optimistic concurrency. When two ...
- 笔记:Activity的启动过程
Activity的创建特点 作为四大组件之一的Activity,它不像普通java对像那样,可以new出来,然后去使用.而是调用 startActivity()这样的方式启动.那么Android系统是 ...