ExtJS 手风琴 setActiveItem

发布于 2024-09-18 00:36:06 字数 279 浏览 9 评论 0原文

我正在使用 ExtJS 开发一个应用程序。 我有一个手风琴,需要选择一个活动项目(因此它会展开)。 Accordion.setActiveItem 输出以下内容:

"setActiveItem" 不是浏览器错误窗口中的函数。

第二个问题是设置时的 hideCollapseTool 属性在初始化中设置为 true,不执行任何操作。折叠工具仍在显示。

我正在使用 ExtJS 3.1.1。 我将非常感谢任何提示和答案。

I am developing an application using ExtJS.
I have an Accordion and need to select an active item(so it expands).
Accordion.setActiveItem outputs the following:

"setActiveItem" is not a function in a browser's error window.

Second issue is that hideCollapseTool property, when set to true in the initialisation, doesn't do anything. Collapse tools still are being displayed.

I am using ExtJS 3.1.1.
I would be very thankful for any tips and answers.

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

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

发布评论

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

评论(5

世界和平 2024-09-25 00:36:07

您还可以通过其组件 ID 来展开手风琴面板中的某些项目,如下所示:

Ext.getCmp('myAccordion').expand();
Ext.getCmp('myAccordion').items.key('myAccordionPanel').expand();

You can also expand some item in an accordion panel by it's component id like this:

Ext.getCmp('myAccordion').expand();
Ext.getCmp('myAccordion').items.key('myAccordionPanel').expand();
随心而道 2024-09-25 00:36:07

我将其修复在一个带有名为userview的引用的控制器中

this.getUserview().items.items[1].expand();

I fixed it in a controller with a ref called userview

this.getUserview().items.items[1].expand();
得不到的就毁灭 2024-09-25 00:36:07
Ext.getCmp('myAccordion').getLayout().setActiveItem(0); // First Child
Ext.getCmp('myAccordion').getLayout().setActiveItem(1); // 2nd Child and so on
Ext.getCmp('myAccordion').getLayout().setActiveItem(0); // First Child
Ext.getCmp('myAccordion').getLayout().setActiveItem(1); // 2nd Child and so on
旧时浪漫 2024-09-25 00:36:07

我花了整整 6 个小时来解决这个问题。 crash() 和 Expand() 似乎不起作用。我会在手风琴下方展开一个面板,其他面板会破裂。

最后发现,如果您的手风琴被隐藏,然后您在子面板上的崩溃()和展开()操作之前显示()它,则会发生一些问题。

我的解决方法是永远不要将手风琴设置为“hidden=true”并且永远不要 show() 它。相反,我使用 style={opacity:0} 开始,然后在需要查看时设置 opacity:100。这解决了所有问题,但不是最优雅的解决方案。

I spent a good 6 hours wrestling with this. collapse() and expand() didn't seem to be working. I'd expand a panel under the accordion and other panels would break.

Finally figured out there is some issue that happens if your accordion is hidden and then you show() it right before collapse() and expand() operations on the sub-panels.

My workaround was to never set the accordion to "hidden=true" and never show() it. Instead, I used style={opacity:0} to begin and then set opacity:100 when I needed to see it. This fixed everything, but isn't the most graceful solution.

幽蝶幻影 2024-09-25 00:36:06

我自己在 setActiveItem 方面运气不佳。在 Firebug 中检查它,手风琴面板甚至没有该方法。

为了解决这个问题,我所做的就是对我想要聚焦的项目调用 expand()
例如:

accordion.items.itemAt(2).expand();

I have had little luck with setActiveItem myself. Examining it in Firebug, the accordion panel doesn't even have that method.

What I did to get around it was to call expand() on the item I want to have focus,
e.g. :

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