给Ext.Toolbar加上remove方法以移除子组件

在用Ext.Toolbar的时候,发现竟然没有remove方法,这样就删除不了item啦,加上下面两个方法.


remove : function(comp, autoDestroy){
var c = this.getComponent(comp);
if(c && this.fireEvent('beforeremove', this, c) !== false){
this.items.remove(c);
delete c.ownerCt;
if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
c.destroy();
}
this.fireEvent('remove', this, c);
}
return c;
},
getComponent : function(comp){
if(typeof comp == 'object'){
return comp;
}
return this.items.get(comp);
}

你可能感兴趣的:(ExtJs)