flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "victor yew (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLEX-34196) Flex mobile prevent item renderer state from recycled
Date Tue, 01 Apr 2014 03:56:14 GMT

     [ https://issues.apache.org/jira/browse/FLEX-34196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

victor yew updated FLEX-34196:
------------------------------

    Attachment: ItemRendererTest.fxp

Please import this project into Flash Builder and run with debugger. There is a list and a
button when launch. Please click the "Change" button to change the itemrenderer state. Then,
click the "refresh" button to refresh the data provider. You will then notice the first item
and the third item swap with each other. 

> Flex mobile prevent item renderer state from recycled
> -----------------------------------------------------
>
>                 Key: FLEX-34196
>                 URL: https://issues.apache.org/jira/browse/FLEX-34196
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: DataGroup
>    Affects Versions: Apache Flex 4.11.0
>         Environment: Window 7 64bit, Flash Builder 4.6
>            Reporter: victor yew
>              Labels: arraycollection, datagroup, itemrenderer, usevirtuallayout
>         Attachments: ItemRendererTest.fxp
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I have this custom list item renderer where I have defined 2 custom states:
> <s:states>
>     <s:State name="expand"/>
>     <s:State name="collapse"/>
> </s:states>
> When I select one of the list item, it will change to state collapse. Now whenever I
select the first or the last item in the list and I refresh the data provider, the current
state of both the items will swap places.
> Please guide me on how to retain the state of the itemrenderer. Thank you.
> Note: It all works well when I change the usevirtuallayout to false. But, it is not what
I intended to change.
> [Edit] The following is my code for the item renderer:
> <fx:Script>
>     <![CDATA[
> protected function init(event):void
> {
>     currentState = "collapse";
> }
> override public function set data(value:Object):void 
> {
>     trace(currentState.toString());
> }
> protected function btn_clickHandler(event:MouseEvent):void
> {
>     currentState = "expand";
> }
> ]]>
> </fx:Script>
> <s:states>
>     <s:State name="expand"/>
>     <s:State name="collapse"/>
> </s:states>
> <s:Button id="changeStateButton" click="btn_clickHandler(event)"/>
> The example above is a simple item renderer where a single button will change the currentState
of the itemrenderer. I have 3 items in the data provider and each one of them is in the "collapse"
state by default. This is the trace result from the set data function:
> collapse
> collapse
> collapse
> When I click the button at the last item... this will be the trace result:
> collapse
> collapse
> expand
> Now, when I refresh the data provider by calling this function "arraycollection.refresh()"...this
is the result:
> expand
> collapse
> collapse
> Can somebody explain this scenario? Notice that this only happens when the useVirtualLayout
is set to true...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message