[英]Extjs5 treepanel [Uncaught TypeError: Cannot read property 'create' of undefined]
[英]ExtJS: Uncaught TypeError: Cannot read property 'scope' of undefined
我已经通过此示例创建了一个面板,并且在tools
config下有2个项目。 这两个项目都有自己的功能,该功能通过ViewController
绑定。 refresh
项目的功能运行良好,但gear
项目的功能在下面给出了此错误;
Uncaught TypeError: Cannot read property 'scope' of undefined
at constructor.addListener (Observable.js?_dc=1516015518102:1135)
at constructor (Observable.js?_dc=1516015518102:403)
at constructor.beforeInitConfig (Component.js?_dc=1516015518101:2261)
at Ext.Configurator.configure (Configurator.js?_dc=1516015518102:558)
at constructor.initConfig (Base.js?_dc=1516015518101:1554)
at constructor (Component.js?_dc=1516015518101:2137)
at new constructor (Class.js?_dc=1516015518101:42)
at Object.widget (ClassManager.js?_dc=1516015518101:1638)
at constructor.create (ComponentManager.js?_dc=1516015518102:76)
at constructor.lookupComponent (Container.js?_dc=1516015518101:1564)
我已经将视图类从app
文件夹移到了classic
文件夹,但是ViewController
类仍保留在app
文件夹中,所以我猜想this
符号会引起错误。 我应该如何在ViewController中声明它?
weatherWindow: function () {
var win = this.lookupReference('weatherWindow');
if (!win) {
win = new MyApp.view.weather.SettingsWindow();
this.getView().add(win);
}
win.show();
},
更新我已经为视图创建了一个ViewController
,但是仍然给出scope
错误!
Ext.define('MyApp.view.dash.WeatherView', {
extend: 'Ext.panel.Panel',
xtype: 'weatherview',
requires: [
'MyApp.view.dash.WeatherViewVC',
],
controller: 'weatherView',
//and..
Ext.define('MyApp.view.dash.WeatherViewVC', {
extend: 'Ext.app.ViewController',
alias: 'controller.weatherView',
requires: [],
weatherWindow: function () {
debugger;
var win = this.lookupReference('settingsWindow');
if (!win) {
win = new MyApp.view.weather.SettingsWindow();
this.getView().add(win);
}
win.show();
},
我已找到此错误的解决方案。 在window类中创建一个函数并返回它;
getSettingsItems: function () {
var me = this;
var settingsItems = [
// whole items listed here!
];
return settingsItems;
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.