Colin Childs created FLEX-33708:
-----------------------------------

             Summary: 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


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

Reply via email to