ExtJs面板 - 添加动态组件 [英] ExtJs panel - adding dynamic components

查看:151
本文介绍了ExtJs面板 - 添加动态组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在窗口里面有一个带有面板的窗口。我将组件动态添加到面板。这些组件处于hbox布局,以便它们水平布置。点击一个按钮,我将在hbox布局中添加一行类似的组件到面板。这里的问题是我想添加第一行下面的第二行,但以下代码将组件添加到面板的顶部。

  panel.add(项目); #it​​ems是hbox布局中的组合框
panel.doLayout();

任何想法来解决这个问题?所以我可以在第一行下面添加第二行组件。



Extjs版本是3.4

解决方案

我发现问题的原因。



原因:当我们使用相同的 id ',然后新添加的组件将被添加到面板的顶部。



修复:使用 itemId 而不是 id ,同时将面板中添加相同的组件。



希望这将是有用的对于某人。


I have a window with panel in inside the window. I add components to the panel dynamically. These components are in 'hbox' layout so that they are arranged horizontally. On click of a button i will add one more row of similar components in 'hbox' layout to the panel. Here the problem is that i want to add the second row below the first row, but the following code adds the components to the top of the panel.

panel.add(items);  #items is the group of comboboxes in hbox layout
panel.doLayout();

Any ideas to solve this problem? so that i can add second row of components below the first row.

Extjs Version is 3.4

解决方案

I found the cause of the problem.

Cause: when we add components with same 'id' to a panel, then the newly added component will get added to the top of the panel.

Fix: Use 'itemId' instead of 'id' while adding same component to the panel.

Hope this will be useful for someone.

这篇关于ExtJs面板 - 添加动态组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆