2 Replies Latest reply on Nov 16, 2010 2:34 PM by ohemmi

    after sorting spark lists selectedItem is incorrect

    ohemmi

      So i have a ArrayCollection that i sort.

      something like...

      var sort:Sort = new Sort;

      sort.fields = [new SortField("my_field")];

      myArrayCollection.sort = sort;

      myArrayCollection.refresh();

       

      This collection is the data provider in my spark list... and an event for change...

      <s:List id="message_list" 

      dataProvider="{myArrayCollection}"

       

      change="list_changeHandler(event)"....>

       

      in my event i have ...

      protected function list_changeHandler(event:IndexChangeEvent):void

      {

           trace(message_list.selectedItem);

      }

       

       

      the message_list.selectedItem is incorrect. It is a different item than the one in the list. If i comment out the sorting part it works just fine, message_list.selectedItem is correct, with the sort the item is incorrect.

       

      Is this a bug? Am i doing something wrong?