Ext4组件显示
Ext4 Component Show
请谅解我正在学习Ext4。
当我运行下面的代码,我得到这个错误:Uncaught TypeError: Cannot call method 'getCount' of undefined
。当我在nsview . implementationstatus . legend中注释代码:list.show()
时,错误消失了。所以我认为它与这个有关,但我真的不明白这是从哪里来的。
Ext.define('NS.controller.ImplementationStatuses', {
extend: 'Ext.app.Controller',
stores: ['ImplementationStatuses'],
models: ['ImplementationStatus'],
views: ['ImplementationStatus.Legend'],
init: function() {
var view = Ext.widget('statusLegend');
}
});
Ext.define('NS.view.ImplementationStatus.Legend', {
extend: 'Ext.window.Window',
alias : 'widget.statusLegend',
views: ['ImplementationStatus.List'],
initComponent: function() {
console.log("Initializing NS.view.ImplementationStatus.Legend");
// This creates the list of statuses
var list = Ext.create('NS.view.ImplementationStatus.List', {});
list.show();
// Define the list of items
this.items = [list];
}
});
Ext.define('NS.view.ImplementationStatus.List', {
extend: 'Ext.panel.Panel',
alias : 'widget.statusList',
initComponent: function() {
console.log("Initializing NS.view.ImplementationStatus.List");
}
});
扩展Ext Component类的推荐方法是使用initComponent函数,就像你正在使用的,但在最后你需要调用this.callParent(arguments);
您可以在指南中看到该模式在所有视图中使用:http://docs.sencha.com/ext-js/4-0/#!/指导/application_architecture
首先,当你为init, initComponent等方法创建重写时,你还必须从原始类调用方法。例如:
Ext.window.Window.prototype.initComponent.apply(this, arguments);
方法完成后错误不再显示
相关文章:
- React重新渲染但未显示正确的组件
- 是否有任何JavaScript UI组件可以显示字符串之间的差异
- 自定义HTML元素属性未显示-Web组件
- 带有内置图像对象的Canvas组件构造函数;t显示's图像
- ReactJS组件中显示的视频未更新
- 在另一个文件夹中显示React组件
- 访问要在 React Native Text 组件中显示的对象数组
- 如何使用Vue.js(使用Vueify)通过组件显示数据
- 如何防止其他元素在拖动任何devexpress组件时高亮显示
- <对象>中的 SVG 不会显示在 IE 的 Angular 2 组件中
- 在火狐附加组件面板中显示远程图像
- Twitter Bootstrap v3.0.0 未显示模态组件
- 显示/隐藏 ReactJS 组件而不会丢失其内部状态
- 角度中的组合框(选择组件)不基于参数设置显示值
- 在 ExtJS 组件中显示富文本
- React路由器未显示组件
- 如何自动隐藏/显示组件
- 使用angularjs隐藏和显示组件
- 使用componentDidMount隐藏/显示组件
- 在Ext.form.Panel中显示组件