Flex 4 - 当我在运行时使用视图状态交换 Spark List itemRenderer 时,List 正在裁剪内容(高度未更新)
我试图通过视图状态(详细信息或打开)使用两个不同的项目渲染器。 itemRenders 显示不同的数据和不同的大小。当单击“已打开”状态的列表项时,状态将更改为“详细信息”并使用新的 itemRenderer。然而,更新后的列表中的内容被剪掉了 25 项以上。我尝试过 invalidateDisplayList() 但似乎不起作用。感谢您的帮助。
<s:List id="list"
currentStateChange="{list.invalidateDisplayList(); list.measuredHeight = 20000}"
dataProvider="{items}"
width.Opened="310"
width.detail="610"
skinClass="skins.ListSkin"
itemRenderer="components.renderers.ListItemRenderer"
itemRenderer.detail="components.renderers.ListItemRendererDetail">
</s:List>
我认为这实际上可能与 Layout 类的 requestRowCount 属性有关。我注意到,即使我将其设置为显示所有行 (-1),在状态更改时它也会默认恢复为不显示所有行。
<s:layout>
<s:VerticalLayout gap="0"
horizontalAlign="contentJustify"
requestedRowCount="-1"/>
</s:layout>
还有一件事,经过一些测试,9998 px 似乎是列表高度的限制,然后它无法再显示所有请求的行和滚动条出现。有解决方法吗?
I am trying to use two different item renderers via view states (detail, or open). The itemRenders display different data and different sizes. When a list item in the Opened state is clicked, the state is changed to detail and a new itemRenderer is used. However, the updated list clips content past 25 items. I have tried invalidateDisplayList() but doesn't seem to work. Thanks for any the help.
<s:List id="list"
currentStateChange="{list.invalidateDisplayList(); list.measuredHeight = 20000}"
dataProvider="{items}"
width.Opened="310"
width.detail="610"
skinClass="skins.ListSkin"
itemRenderer="components.renderers.ListItemRenderer"
itemRenderer.detail="components.renderers.ListItemRendererDetail">
</s:List>
I think it might actually have to to with the requestedRowCount property of the Layout class. I noticed that even if I set it to show all rows (-1), on a state change it defaults back to not showing all rows.
<s:layout>
<s:VerticalLayout gap="0"
horizontalAlign="contentJustify"
requestedRowCount="-1"/>
</s:layout>
And one more thing, After some testing, 9998 px seems to be the limit for a List's height before it can no longer show all requested rows and scrollbars appear. Is there a workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我的想法完全错误。 9998px 似乎确实是 Spark List 高度的限制,但没有必要将高度设置得那么大。较小的 px 高度就可以了。如果启用滚动,它将滚动浏览整个项目列表。
Well, I was going at this completely wrong. 9998px does appear to be the limit of a Spark List height, but theres no need to make the height that large. A smaller px height is fine. If scrolling is enabled it will scroll throught the entire list of items.