用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. redis的key过期时间

    public void set(String key,String value,int liveTime){ this.set(key, value); this.getJedis().expire( ...

  2. git stash

      https://git-scm.com/docs/git-stash   NAME git-stash - Stash the changes in a dirty working directo ...

  3. 1136. Parliament(二叉树)

    1136 先由后左 再父 建一个二叉树 #include <iostream> #include<cstdio> #include<cstring> #includ ...

  4. [Unity3d]小地图的制作

    继续今天的学习心得,unity中小地图的制作,实现了小地图中红色小箭头代表场景中的主角,然后人物方向的转变,小地图中箭头也随之改变方向. 效果图     右上角就是小地图,上面有个红色小箭头就是代表主 ...

  5. compass和sass很好的两篇文章

    Sass是一种"CSS预处理器",可以让CSS的开发变得简单和可维护.但是,只有搭配Compass,它才能显出真正的威力. 本文介绍Compass的用法.毫不夸张地说,学会了Com ...

  6. 【App FrameWork】页面之间的参数传递

    若应用中有多个页面,这时2个页面之间可能需要进行参数传递.那么如何来实现呢? 首先想到的就是URL参数传递的方式,如:在panel里设置属性 data-defer="Pages/Shake. ...

  7. JSOI2007建筑抢修

    实际上和大多这类题一样(比如wikioi上的地鼠游戏),考察的都是堆的操作 这次改完之后就算把堆的模版定下来了 悲剧的是:大根堆打成了小根堆,导致一开始一直是10分…… 按结束时间排序,(经过验证,结 ...

  8. CDN-内容推送网络

    前段时间介绍了浏览器缓存机制,通过浏览器缓存一方面可以改善用户的体验,而不用漫长地等待从服务器下载资源:另一方面减轻服务器压力.节省流量.CDN是另一种可以大幅度优化用户体验,且减轻服务器压力的技术. ...

  9. 【聚类算法】谱聚类(Spectral Clustering)

    目录: 1.问题描述 2.问题转化 3.划分准则 4.总结 1.问题描述 谱聚类(Spectral Clustering, SC)是一种基于图论的聚类方法——将带权无向图划分为两个或两个以上的最优子图 ...

  10. WCF 学习总结2 -- 配置WCF

    前面一篇文章<WCF 学习总结1 -- 简单实例>一股脑儿展示了几种WCF部署方式,其中配置文件(App.config/Web.config)都是IDE自动生成,省去了我们不少功夫.现在回 ...