gpt4 book ai didi

javascript - Ext4 组件展示

转载 作者:行者123 更新时间:2023-11-30 13:25:51 33 4
gpt4 key购买 nike

请保持礼貌,我正在学习 Ext4。

当我运行下面的代码时出现此错误:Uncaught TypeError: Cannot call method 'getCount' of undefined。当我注释掉代码时:NS.view.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 组件类的推荐方法是像您正在使用的那样使用 initComponent 函数,但最后您需要调用 this.callParent(arguments);

您可以在指南的所有 View 中看到此模式:http://docs.sencha.com/ext-js/4-0/#!/guide/application_architecture

关于javascript - Ext4 组件展示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8523971/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com