用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的更多相关文章

  1. Extjs4---Cannot read property 'addCls' of null - heirenheiren的专栏 - 博客频道 - CSDN.NET

    body { font-family: 微软雅黑,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLi ...

  2. Extjs4---Cannot read property 'addCls' of null 或者 el is null 关于tab关闭后再打开不显示或者报错

    做后台管理系统时遇到的问题,关于tab关闭后再打开不显示,或者报错 我在新的tabpanel中加入了一个grid,当我关闭再次打开就会报错Cannot read property 'addCls' o ...

  3. 百度ueditor 实例化 Cannot set property 'innerHTML' of null 完美解决方案

    此时此刻,我正在用博客园推荐的TinyMCE编辑器写这个博客,突然想起最近在项目中使用百度ueditor编辑器中的一些经历.所以记录在此,与大家分享. 不得不说,百度ueditor是一款很好的在线编辑 ...

  4. 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 ...

  5. Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null

    在开发Ext 项目中如果遇到 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null 这个错误,检查下renderT ...

  6. extjs Cannot read property 'dom' of null

    如果你的EXTJS报错: Cannot read property 'dom' of null,那就有可能是因为你的HTML或者JSP文件中的BODY标签里面少了个东西比如代码是: <html& ...

  7. Uncaught TypeError: Cannot set property 'innerHTML' of null

    学习Chrome插件时,要在弹出页面中显示当前时间,结果怎样也显示不出来 看了 http://www.cnblogs.com/mfryf/p/3701801.html 这篇文章后感悟颇深 通过调试发现 ...

  8. hibernate级联保存问题,出错not-null property references a null or transient value

    Servlet.service() for servlet default threw exception org.hibernate.PropertyValueException: not-null ...

  9. 错误:Cannot set property 'innerHTML' of null

    360浏览器代码编辑器里提示错误:Cannot set property 'innerHTML' of null 原因是代码执行时要调用的内容不存在

随机推荐

  1. altium designer 13 学习之添加汉字

    在altium desginer中如果你是想添加英文还是比较方便的,基本直接就可以输入了,但是添加中文就不是那么简单了,下面不介绍下如何在altium designer中快速的添加自己想要的中文 工具 ...

  2. Android:自定义适配器

    无论是ArrayAdapter还是SimpleAdapter都继承了BaseAdapter,自定义适配器同样继承BaseAdapter 实例:Gallery实现图片浏览器 <?xml versi ...

  3. sqlmap批量扫描burpsuite请求日志记录

    sqlmap可以批量扫描包含有request的日志文件,而request日志文件可以通过burpsuite来获取, 因此通过sqlmap结合burpsuite工具,可以更加高效的对应用程序是否存在SQ ...

  4. Linux命令面试常考的简单汇总

    1.显示日期与时间的命令:date 2.显示日历的命令:cal 3.简单好用的计算器:bc 4.热键“命令补全或文件补齐”:Tab 5.热键“中断目前程序”:Ctrl+C 6.热键“键盘输入结束(En ...

  5. wince下sources\sources.cmn\Makefile.def的相关作用

    1:首先是Makefile.def: ---------------------------------------- 在所有驱动的makefile中有!INCLUDE $(_MAKEENVROOT) ...

  6. Smallest unused ID

    http://www.codewars.com/kata/smallest-unused-id Description: Hey awesome programmer! You've got much ...

  7. UVa 12171 (离散化 floodfill) Sculpture

    题意: 三维空间中有n个长方体组成的雕塑,求表面积和体积. 分析: 我们可以在最外边加一圈“空气”,然后求空气的连通块的体积,最后用总体积减去即是雕塑的体积. 还有一个很“严重”的问题就是5003所占 ...

  8. (转载)有关反演和gcd

    tips : 积性函数 F (n) = Π F (piai ) 若F (n), G (n)是积性函数则 F (n) * G (n) Σd | n F (n) 是积性函数 n = Σd | n  φ ( ...

  9. Java [leetcode 37]Sudoku Solver

    题目描述: Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated ...

  10. 【转】iOS中设置导航栏标题的字体颜色和大小

    原文网址:http://www.360doc.com/content/15/0417/11/20919452_463847404.shtml iOS中设置导航栏标题的字体颜色和大小,有需要的朋友可以参 ...