用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. Android_Mars学习笔记_S01_001activity初步

    一.activity初步 1.程序启动会先读配置文件AndroidManifest.xml找activity 2.activity会在onCreate方法中读取activity_main.xml文件, ...

  2. font-size:100%和font-size:0

    h1,h2,h3,h4,h5,h6 {font-size:100%;} 正常情况下hx按照一定百分比增加字号,但是指定font-size:100%;就会继承body设置的字体大小 font-size: ...

  3. vimrc for windows

    set nobackupsource $VIMRUNTIME/vimrc_example.vimsource $VIMRUNTIME/mswin.vimbehave mswin:color deser ...

  4. NAT负载均衡

    NAT(Network Address Translation 网络地址转换)简单地说就是将一个IP地址转换为另一个IP地址,一般用于未经注册的内部地址与合法的.已获注册的Internet IP地址间 ...

  5. C#获取cpu序列号 硬盘ID 网卡硬地址以及操作注册表 .

    转:http://blog.csdn.net/smartsmile2012/article/details/8682295 #region 获取cpu序列号 硬盘ID 网卡硬地址 /**/ /// & ...

  6. 数据关联分析 association analysis (Aprior算法,python代码)

    1基本概念 购物篮事务(market basket transaction),如下表,表中每一行对应一个事务,包含唯一标识TID,和购买的商品集合.本文介绍一种成为关联分析(association a ...

  7. CHtmlView类的中文介绍

    http://zhidao.baidu.com/link?url=h8FaKA6FMNXzYJu_XO-_buBxuGdM0jozKUSVv6pgEPsvhTB2-xLltH-jVLDDJKMBAkn ...

  8. netty 实现socket服务端编写

    import java.net.InetSocketAddress; import io.netty.bootstrap.ServerBootstrap; import io.netty.channe ...

  9. MySql命令的基本操作

    MySQL的基本命令: 登录:mysql  -h -u root -p password:*****; 例如:mysql -h127.0.0.1 -uroot -p 增加一个用户: grant all ...

  10. (转载)Let's Play Games!

    第1题  Alice和她的同学Bob通过网上聊天商量明天早晨谁去教室打扫卫生的事,Bob说:“我在桌上放了一枚硬币,你猜一下,是正面朝上还是反面朝上?如果猜对了,我去扫地.如果猜错了,嘿嘿….” Al ...