flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Harui (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33708) ArrayCollection addItemAt() does not work correctly after removing sort
Date Thu, 05 Sep 2013 03:03:51 GMT

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

Alex Harui commented on FLEX-33708:

Setting sort to null should return the AC to the order before the sort was applied.  When
you did that, did addItems("0", 0) end up at the beginning?  If so, this is not a bug.

An AC is a view of an array.  When the AC is sorted or filtered, the source array is not modified.
 So, using toArray to generate a new source array is correct if you want to "freeze" a particular
sorted view.
> 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

View raw message