flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Childs (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33708) ArrayCollection addItemAt() does not work correctly after removing sort
Date Tue, 17 Sep 2013 15:00:59 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13769579#comment-13769579
] 

Colin Childs commented on FLEX-33708:
-------------------------------------

Alex, yes, that is what I get. I understand that the second refresh resets the list back to
its original state and should return 0,2,1,3. The issue in question is when trying to call
addItemAt() BEFORE the second refresh (after setting the sort to null). At that point, I would
expect the list to return 0,1,2,3. This is how it behaved in Flex 4.6. In Flex 4.10.0, it
returns 1,2,3,0. In other words, before calling the second refresh, any calls to addItemAt()
put the item at the end of the list. I suppose this is not a huge issue and my workaround
solved the issue for me, but in my opinion it is a bug and is counterintuitive. Although,
I totally understand the arguments that have been made and would understand if it is not considered
a bug.
                
> ArrayCollection addItemAt() does not work correctly after removing sort
> -----------------------------------------------------------------------
>
>                 Key: FLEX-33708
>                 URL: https://issues.apache.org/jira/browse/FLEX-33708
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Collections
>    Affects Versions: Apache Flex 4.10.0
>         Environment: Tested on Windows 7 with AIR simulator and on iPhone 5
>            Reporter: Colin Childs
>              Labels: ArrayCollection, flex4.10
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> After sorting an ArrayCollection, removing the sort, then adding an item at an index
always adds it to the end of the list. I ran into this while sorting a dropdown alphabetically,
then setting the ArrayCollection's sort to null, and trying to add something at the top of
the list, such as "Select One". This works fine in Flex 4.6.
> Here is a simple example (and workaround):
> var col:ArrayCollection = new ArrayCollection();
> col.addItem("1");
> col.addItemAt("2", 0); //works as expected
> col.addItemAt("3", 2); //works as expected
> 				
> col.sort = new Sort();
> col.refresh();
> col.sort = null;
> 				
> //workaround:
> //var temp:ArrayCollection = new ArrayCollection(col.toArray());
> //col = temp;
> 				
> col.addItemAt("0", 0);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message