是否有任何可折叠的弹性容器可以处理预折叠时有效的动态内容?
您是否知道任何可以处理预折叠时有效的动态内容的可折叠弹性容器?
我尝试了Arc90 for Flex的CollapsiblePanel组件,但在预折叠时它不起作用。
如果我在面板内有一个 VBox,并且将 CollapsiblePanel 的“collapsed”属性设置为 true,则无法恢复 CollapsiblePanel 的大小。看起来这就是正在发生的事情:
- CollapsiblePanel 的折叠属性在 MXML 标记中预先设置为 true。
- 由于 CollapsiblePanel 折叠,VBox 会自动将其高度调整为 0。
- 当 CollapsiblePanel 的折叠属性更改为 false(即,由用户展开)时,VBox 不会自行展开,因为其父级的内容区域为 0。
- 因此,CollapsiblePanel 保持相同的高度,因为其内容的高度为 0。
- 因此。 ..
注意:仅当 CollapsiblePanel 预折叠时才会发生这种情况,如下面的标记所示。
我已经尝试过此操作(不起作用):
<containers:CollapsiblePanel minimize="pnl_minimize(event)"
restore="pnl_restore(event)" height="100%" width="100%" collapsed="true">
<mx:VBox width="100%" height="100%" verticalGap="0">
<mx:LinkButton id="lnkSales1" label="Sales 1" />
<mx:LinkButton id="lnkSales2" label="Sales 2" />
</mx:VBox>
</containers:CollapsiblePanel>
private function pnl_restore(event:Event):void
{
var objPanel:CollapsiblePanel = event.target as CollapsiblePanel;
var objChildArray:Array = objPanel.getChildren();
for each (var obj:Object in objChildArray)
{
obj.invalidateSize();
}
objPanel.invalidateSize();
}
是否有人成功做到了像这样的东西?你使用了什么组件?
Do you know any collapsible flex container that can handle dynamic content that works when pre-collapsed?
I tried the CollapsiblePanel component by Arc90 for Flex, but it did not work when pre-collapsed.
If I have a VBox inside the panel, and I set the "collapsed" property of the CollapsiblePanel to true, the size of the CollapsiblePanel cannot be restored. It seems like this is what is happening:
- The CollapsiblePanel's collapsed property is pre-set to true in the MXML markup.
- The VBox auto-adjusts its height to 0 since the CollapsiblePanel is collapsed.
- When the CollapsiblePanel's collapsed property changes to false (i.e., it is expanded by the user), the VBox does not expand itself because its parent's content area is 0.
- Therefore the CollapsiblePanel remains at the same height because its content's height is 0.
- Therefore...
Note: This occurs only when the CollapsiblePanel is pre-collapsed, as seen in the markup below.
I've already tried this (didn't work):
<containers:CollapsiblePanel minimize="pnl_minimize(event)"
restore="pnl_restore(event)" height="100%" width="100%" collapsed="true">
<mx:VBox width="100%" height="100%" verticalGap="0">
<mx:LinkButton id="lnkSales1" label="Sales 1" />
<mx:LinkButton id="lnkSales2" label="Sales 2" />
</mx:VBox>
</containers:CollapsiblePanel>
private function pnl_restore(event:Event):void
{
var objPanel:CollapsiblePanel = event.target as CollapsiblePanel;
var objChildArray:Array = objPanel.getChildren();
for each (var obj:Object in objChildArray)
{
obj.invalidateSize();
}
objPanel.invalidateSize();
}
Is there anyone who has succeeded in doing something like this? What component did you use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于找到了解决方案,尽管这只是一种解决方法。我允许加载所有面板,然后以编程方式折叠它们,而不是在标记中预先折叠它们。这样,它们的大小就已经计算出来,并且当用户恢复它们时可以毫无问题地恢复它们。
有人有更好的解决方案吗?
Finally got a solution, though it's a bit of a workaround. I allow all the panels to be loaded and then collapse them programmatically instead of pre-collapsing them in the markup. This way their size is already computed and can be restored without any issues when the user restores them.
Does anyone have a better solution?