面板不会触发“添加”或“删除”,当添加或删除项目时

发布于 2024-11-18 06:54:40 字数 1807 浏览 2 评论 0原文

这是我的面板(注意听众):

ToolbarDemo.views.homecard = Ext.extend(Ext.Panel, 
{
    title: "Meny",
    iconCls: "home",
    scroll: "vertical",
    tpl: [
        '<tpl for=".">',
        '   <div class="x-component" style="height: 110px">',
        '       <div class="home_button_container">',
        '           <img class="home_button" src="{url_icon_large}" />',
        '           <p class="home_button_text">{name}</p>',
        '       </div>',
    '       </div>',
        '</tpl>'
    ], 
    bodyStyle: "background-color: #FFFFFF !important; background-image: url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
    initComponent: function() 
    {
        Ext.apply(this, 
        {
            dockedItems: [{
                xtype: "toolbar"
            }],
            defaults: {height: "110px"},
            items: [
                componentArray
            ]
        }); 

        this.addListener("added", function()
        {
            console.log("Somthing has been added");
            this.doLayout();
        })

        this.addListener("render", function()
        {
            makeJSONPRequest();
            console.log("Finished rendering");
            this.doLayout();
        })

        this.addListener("removed", function()
        {
            console.log("Somthing has been removed");
            this.doLayout();
        })
            //item(fronterButton);
        ToolbarDemo.views.homecard.superclass.initComponent.apply(this, arguments);
    }

});

当我删除所有内容时,什么

ToolbarDemo.views.homecard.removeAll();

也没有发生。什么都没有着火。没什么。

我什至尝试通过控制台删除所有内容,但没有任何反应。

有谁知道问题可能是什么?

提前致谢

This is my panel (Take notice of the listeners):

ToolbarDemo.views.homecard = Ext.extend(Ext.Panel, 
{
    title: "Meny",
    iconCls: "home",
    scroll: "vertical",
    tpl: [
        '<tpl for=".">',
        '   <div class="x-component" style="height: 110px">',
        '       <div class="home_button_container">',
        '           <img class="home_button" src="{url_icon_large}" />',
        '           <p class="home_button_text">{name}</p>',
        '       </div>',
    '       </div>',
        '</tpl>'
    ], 
    bodyStyle: "background-color: #FFFFFF !important; background-image: url(images/background.png) !important; background-repeat:no-repeat; background-position:bottom left;",
    initComponent: function() 
    {
        Ext.apply(this, 
        {
            dockedItems: [{
                xtype: "toolbar"
            }],
            defaults: {height: "110px"},
            items: [
                componentArray
            ]
        }); 

        this.addListener("added", function()
        {
            console.log("Somthing has been added");
            this.doLayout();
        })

        this.addListener("render", function()
        {
            makeJSONPRequest();
            console.log("Finished rendering");
            this.doLayout();
        })

        this.addListener("removed", function()
        {
            console.log("Somthing has been removed");
            this.doLayout();
        })
            //item(fronterButton);
        ToolbarDemo.views.homecard.superclass.initComponent.apply(this, arguments);
    }

});

When i do a remove all

ToolbarDemo.views.homecard.removeAll();

Nothing happens. Nothing fires. Nada.

i've even tried removeAll through the console, but nothing fires.

Does anyone have a clue what the problem could be?

Thanks in advance

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

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

发布评论

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

评论(1

冰雪梦之恋 2024-11-25 06:54:40

你听到了错误的事件。

如果您想监听容器上添加/删除的项目,您需要添加/删除。

如果您想侦听从容器中添加/删除的组件,则需要添加/删除。

You're listening to the wrong events.

If you want to listen for items being added/removed on a container, you want add/remove.

If you want to listen for a component being added/removed from a container, you want added/removed.

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