extjs动态地向选项卡添加网格?
|
在我的extjs标签面板中,有一个标签。在标签中,我做了:
this.tab.add(this.someGrid1);
现在基于特定条件,我想做:
if (cond ==true)
this.tab.remove(this.someGrid1);
this.tab.add(this.someGrid2);
这可能吗?
我试过没有删除,它不起作用。什么都没发生,旧的someGrid1仍然存在。
编辑:通过建议,我将代码更改为:
if (cond ==true)
this.tab.remove(this.someGrid1);
this.tab.add(this.someGrid2);
this.tab.doLayout();
else if (cond ==false)
this.tab.remove(this.someGrid2);
this.tab.add(this.someGrid1);
this.tab.doLayout();
加载页面时,cond == true
表示一切正常。当我通过组合将cond更改为false时,someGrid1加载正常。
当我改回cond ==true
时,代码不会执行超出
this.tab.add(this.someGrid2);
this.tab.doLayout();
并且someGrid2不呈现。错误是这样的:
Error: b.getPositionEl().dom is undefined
没有找到相关结果
已邀请:
3 个回复
你换
是
重新渲染组件。
弛保矮瘦敖
方法时验证是否正确设置了
?在Ext中弄乱您的
示波器很容易。 没关系,但是您也可以尝试将
作为第二个参数添加到
。这将迫使Ext破坏该组件,并且与其关联的所有dom都将消失。 如果您仍然无法正常工作,也许会发布一些其他代码,但是我敢打赌,如果您使用Firebug并调试此功能,解决方案将显而易见。
咖哀烈
错误消息的原因。