Extjs4---Cannot read property 'addCls' of null
用MVC做后台管理系统时遇到的问题,关于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);
} });
Extjs4---Cannot read property 'addCls' of null的更多相关文章
- Extjs4---Cannot read property 'addCls' of null - heirenheiren的专栏 - 博客频道 - CSDN.NET
body { font-family: 微软雅黑,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLi ...
- Extjs4---Cannot read property 'addCls' of null 或者 el is null 关于tab关闭后再打开不显示或者报错
做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错 我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCls' o ...
- 百度ueditor 实例化 Cannot set property 'innerHTML' of null 完美解决方案
此时此刻,我正在用博客园推荐的TinyMCE编辑器写这个博客,突然想起最近在项目中使用百度ueditor编辑器中的一些经历.所以记录在此,与大家分享. 不得不说,百度ueditor是一款很好的在线编辑 ...
- org.hibernate.PropertyValueException: not-null property references a null or transient value:
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.bj ...
- Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
在开发Ext 项目中如果遇到 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null 这个错误,检查下renderT ...
- extjs Cannot read property 'dom' of null
如果你的EXTJS报错: Cannot read property 'dom' of null,那就有可能是因为你的HTML或者JSP文件中的BODY标签里面少了个东西比如代码是: <html& ...
- Uncaught TypeError: Cannot set property 'innerHTML' of null
学习Chrome插件时,要在弹出页面中显示当前时间,结果怎样也显示不出来 看了 http://www.cnblogs.com/mfryf/p/3701801.html 这篇文章后感悟颇深 通过调试发现 ...
- hibernate级联保存问题,出错not-null property references a null or transient value
Servlet.service() for servlet default threw exception org.hibernate.PropertyValueException: not-null ...
- 错误:Cannot set property 'innerHTML' of null
360浏览器代码编辑器里提示错误:Cannot set property 'innerHTML' of null 原因是代码执行时要调用的内容不存在
随机推荐
- UML各种图画法总结
<UML 2.4.1 教程> http://www.sparxsystems.cn/resources/uml2_tutorial/ <UML总结(对九种图的认识和如何使用Ratio ...
- 关于TableView中出现deallocated问题
Message sent to deallocated instance 关于的ios 开发中 deallocated问题,相信大家遇到了不少了: 关于怎么查找解决这个问题,特别是当问题在tableV ...
- C++ STL stack和queue
C++ STL中独立的序列式容器只有vector,list,deque三种,stack和queue其实就是使用容器适配器对deque进行了封装,使用了新接口. 使用标准库的栈和队列时,先包含相关的头文 ...
- IE9 表格错位bug
最近做项目的时候,出现一个只在原生IE9(非模拟)下的bug. bug图片如下: 以上两个模块的html代码和样式都是一样的,然而下面的显示却出现了各种对齐的bug. 用IE9的调试器查看,代码完全一 ...
- poj3186 poj3267
两道很不错的dp 3186很神似回文词,合并石子之类的问题: 一开始不知道怎么在dp方程中体现权值天数,很来才想起来 对于一段区间[i,j],里面的东西必然是要卖完的 又因为只能从两头开始卖,所以 d ...
- [原]Unity3D深入浅出 - 角色控制器(Character Controller)
角色控制器主要用于第一人称和第三人称主角的控制,并不使用刚体物理效果. 添加角色控制器的方法:依次打开菜单栏中的Component - Physiscs - Character Controller ...
- js实现对数据库的增删查改
1.查询 复制代码 代码如下: <HTML> <HEAD> <TITLE>数据查询</TITLE> <Script > var conn = ...
- CodeForces Round #286 Div.2
A. Mr. Kitayuta's Gift (枚举) 题意: 给一个长度不超过10的串,问能否通过插入一个字符使得新串成为回文串. 分析: 因为所给的串很多,所以可以枚举 “在哪插入” 和 “插入什 ...
- JQuery向ashx提交中文参数方案
客户端://异步获取数据var tpAction=action+'getSearch.ashx?key='+encodeURIComponent('中国'); $.getJSON(tpAction,f ...
- error LNK2001: 无法解析的外部符号 _IID_IDirectDraw7
工程使用了DirectDraw,编译出错 error LNK2001: 无法解析的外部符号 _IID_IDirectDraw7 解决办法是吧dxguid.lib添加到工程中,把lib所在目录添加到工程 ...