用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中如何取消调转界面后EditText默认获取聚焦问题

    最近在做一个项目,当我点击跳转至一个带有EditText的界面后,模拟器中的软键盘会自动弹出,严重影响了用户体验.在网上找了资料,现总结如下. 我们知道,EditText有一个 android:foc ...

  2. windows8 64位 IIS8 PHP5.5 安装 Imagemagick 组件

    为什么这里一定要说 windows 系统是64位呢,因为如果是系统是64位,那么PHP5.5 一般都会选择64的, Imagemagick 组件也会选择64位的, 但是操蛋的是 64位的Imagema ...

  3. Oracle学习笔记之数据类型

    1. mysql和oracle做数据同步.其中表的一个字段在mysql中设置为varchar(6),Oracle中为varchar2(6)   但mysql中能正常存放的数据同步到oracle中却抱O ...

  4. JavaScript动态操作style

    1.易错:修改元素的样式不是设置class属性,而是className属性.class是JS的一个保留关键字. 2.易错:单独修改样式的属性使用"style.属性名"3.注意在cs ...

  5. P147、面试题26:复杂链表的复制

    题目:请实现ComplexListNode* Clone(ComplexListNode* pHead),复制一个复杂链表.在复杂链表中,每个结点除了有一个m_pNext指针指向下一个结点外,还有一个 ...

  6. 【HDOJ】1648 Keywords

    PE的注意,如果没有满足条件的不输出空格.简单模拟,暴力解. /* */ #include <iostream> #include <sstream> #include < ...

  7. 八大Webkit内核浏览器

    列举出时下最流行的Webkit内核浏览器,所以我们并不会做出评测和对比.PS:本文列举的浏览器有一部分为IE+Webkit双核浏览器,如果您对其他IE内核浏览器很感兴趣<抛弃数据!用体验和感觉告 ...

  8. CSS那些事儿-阅读随笔2(选择符的组合与优先级/权重)

    在知道了CSS选择符最基础的知识后,就要综合利用它们了.这里就记录几种常见的用法. 1.针对性的使用类选择符或者ID选择符 类选择符在一个页面中可能会在不同的地方应用,那么就需要有针对性地使用类选择符 ...

  9. JQuery focus()

    跳转到登陆页面时可以使用focus方法 <input name="login_account"id="login_account"class=" ...

  10. NET下RabbitMQ实践[WCF发布篇]

    在之前的两篇文章中,主要介绍了RabbitMQ环境配置,简单示例的编写.今天将会介绍如何使用WCF将RabbitMQ列队以服务的方式进行发布.          注:因为RabbitMQ的官方.net ...