ExtJs 添加面板作为选项卡项

发布于 2024-08-23 22:35:40 字数 474 浏览 4 评论 0原文

我有一个 设置,其中预计将根据用户选择加载选项卡左面板树中的项目。我的目标是根据用户选择仅将相关项目加载到特定选项卡。

第一次,我能够添加项目如下:

    var tab = tabs1.getItem('Orders');   
    tab.remove(0);
    tab.add(pane33);
    tab.doLayout(); 

但是,当用户再次选择该项目时,面板项目已被删除,并且错误为 (c.getPositionEl().dom is undefined)。

该错误是由于该项目被删除或销毁造成的。似乎没有选项可以替换选项卡项目或刷新/重新加载面板。

这要怎么处理呢?

谢谢。

I have a setup where the tab is expected to be loaded based on user selection of an item from a left panel tree. My objective is to load only the relevant items as per the user selection to a particular tab.

The first time, I am able to add item as below:

    var tab = tabs1.getItem('Orders');   
    tab.remove(0);
    tab.add(pane33);
    tab.doLayout(); 

But, when the user selects the item again, the panel item is already removed, and errors out as (c.getPositionEl().dom is undefined).

The error is due to the item being removed or destroyed. There seems no option to replace the tab item, or to refresh/reload panels.

How to handle this?

Thanks.

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

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

发布评论

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

评论(2

差↓一点笑了 2024-08-30 22:35:41

Container.remove 有一个可选的第二个参数 autoDestroy,这意味着被删除的组件也会被永久销毁(对于 TabPanel,默认为 true) 。您仅实例化您的子组件一次,因此在它们被销毁后,将无法再添加它们。要么传递 autoDestroy: false (这也可以在 TabPanel 级别设置)并在删除现有组件后隐藏它们(然后只需在后续单击时显示它们),否则您必须在之前重新实例化它们每次都添加。

Container.remove has an optional second argument autoDestroy, which means the component being removed is also destroyed permanently (for TabPanels, this defaults to true). You are only instantiating your child components one time, so after they get destroyed they are no longer available to be added. Either pass autoDestroy: false (this can be set at the TabPanel level as well) and hide existing components after removing them (then simply show them on subsequent clicks), or you'll have to reinstantiate them before adding each time.

茶色山野 2024-08-30 22:35:41

您可以将该选择标记为“已选择”并检查鼠标操作。作为一种简单的方法。

you can mark that selection as 'selected' and check at mouse actions. as a simple approach.

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