1 Reply Latest reply on Jun 12, 2007 8:10 AM by skinrock

    Custom sort not updating selectedIndex

    skinrock
      I have an array collection that is the dataProvider for a List element. This array collection has a custom sort applied to it, it follows the basic rules of returning -1, 0 or 1 depending on what position I want to move the element to. However, I found what seems to be a bug, in that...when I have an item selected in my list, if the sort function changes the order of the items in such a way that the selected index should change, I am not seeing the new selected index. Here's a detailed scenario:

      Item 0 - selected, selectedIndex property = 0
      Item 1
      Item 2

      Sort causes Item 1 to move into first position:

      Item 1
      Item 0 - selected, selectedIndex property is still 0
      Item 2

      I was wondering if there is an event I have to dispatch, or what I have to do to update the selectedIndex. The reason this is such a problem, is that I can't select Item 0, and I believe this is because it still thinks selectedIndex is 0.

      Is there a reason why the sorter isn't updating this property?