sencha 文档上的 ExtJS4 MVC 架构演练给我错误

发布于 2025-01-03 06:47:53 字数 911 浏览 2 评论 0原文

我正在关注 ExtJS4.0 MVC 应用程序架构演练< /a> 并将其修改为我自己的项目,以确保我做对了。到目前为止,它工作得很好。我刚刚完成了“定义视图”部分,即将开始“控制网格”部分。在此之前,我想删除 console.log 代码,因为我自己的项目不需要或不需要它。我发现我可以用警报消息替换它,但无法将其全部删除而不生成针对 ext-all-debug.js 的错误。

这是我在控制器上的功能代码以及删除 consol.log 函数后生成的错误。在示例文档中,它是 AM.controllers.list。

Ext.define('ChatAgent.controller.queues', {
extend: 'Ext.app.Controller'
, views: [
    'queue.list'
]
, init: function() {
    this.control({
        'viewport > panel': {
            render: this.onPanelRendered
        }
    });
}

, onPanelRendered: function() {
    console.log('The panel was rendered');
}

});

它产生的错误是: “fireFn”为空或不是对象

我删除的只是:

onPanelRendered: function() {
        console.log('The panel was rendered');
    }

那么为什么会出现错误???

I'm following the ExtJS4.0 MVC Application Architecture walk through and modifying it to my own project as I go to make sure I get things right. So far it's working perfectly. I've just completed the 'Defining a View' section and I'm about to start the 'Controlling the grid' section. Before I do, I want to remove the console.log code as I don't want or need it for my own project. I find I can replace it with an alert message but can't remove it all together without generating an error against ext-all-debug.js.

Here's my functioning code on the controller and the error it's generating after I remove the consol.log function. In the example doc, it's AM.controllers.list.

Ext.define('ChatAgent.controller.queues', {
extend: 'Ext.app.Controller'
, views: [
    'queue.list'
]
, init: function() {
    this.control({
        'viewport > panel': {
            render: this.onPanelRendered
        }
    });
}

, onPanelRendered: function() {
    console.log('The panel was rendered');
}

});

The error it generates is:
'fireFn' is null or not an object

All I've removed is:

onPanelRendered: function() {
        console.log('The panel was rendered');
    }

So why the error???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生活了然无味 2025-01-10 06:47:53

您还需要删除事件侦听器。当渲染事件触发时,它试图调用不再存在的 onPanelRendered 。

如果您没有监听任何事件,则甚至不需要整个 this.control 块。将此注释掉,看看会发生什么。

this.control({
    'viewport > panel': {
        render: this.onPanelRendered
    }
});

You need to get rid of the event listener as well. When the render event fires it is trying to call onPanelRendered which doesn't exist anymore.

If you aren't listening for any events, you don't even need to have that entire this.control block. Comment this out and see what happens.

this.control({
    'viewport > panel': {
        render: this.onPanelRendered
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文