[
https://issues.apache.org/jira/browse/FLEX-33708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13765132#comment-13765132
]
Justin Mclean commented on FLEX-33708:
--------------------------------------
The issue is question is in addItem at:
// List is sorted or filtered but refresh has not been called
// Just add to end of list
else if (localIndex)
{
listIndex = list.length;
}
Changing this would likely to have unwanted side effects, the issue being in
this state the code doesn't know if the list has been filtered and/or sorted so
doesn't know where to add the item.
> 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