繁体   English   中英

ExtJS:未捕获的TypeError:无法读取未定义的属性“作用域”

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM