面板不会触发“添加”或“删除”,当添加或删除项目时
这是我的面板(注意听众):
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你听到了错误的事件。
如果您想监听容器上添加/删除的项目,您需要添加/删除。
如果您想侦听从容器中添加/删除的组件,则需要添加/删除。
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.