2011-07-05 68 views
1

时,这是我的面板(以听众的通知):小组将不火“添加”或“删除”,添加或删除项目

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(); 

没有任何反应。什么都不会发生。纳达。

我甚至尝试通过控制台removeAll,但没有任何火灾。

有没有人有任何线索可能是什么问题?

在此先感谢

回答

2

您正在听错了事件。

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

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

+0

:)这是真的。谢谢! – Ikky