开发者

Flex 4 - When I swap a Spark List itemRenderer at runtime using view states, List is clipping content (height not updated)

开发者 https://www.devze.com 2023-02-08 12:01 出处:网络
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 stat

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. I开发者_StackOverflows there a workaround?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号