Skip navigation
Currently Being Moderated

stuck in ListBase.setSelectionDataLoop

Mar 18, 2011 2:21 AM

Sometimes when I set the selectedItem of a Tree after changing its dataprovider, the application freezes :

when I debug and look at the collectionIterator of the Tree, it still has information of the old dataprovider, and the ListBase.setSelectionDataLoop enters an infinite loop.

 

I tried to set the selectedItem in a callLater, and call :

tree.invalidateList();
tree.invalidateSize();
tree.invalidateDisplayList();
tree.validateNow();

 

and it works in most of the cases, but in some cases my application still freezes.

 

Do you know how can I be sure to update my Tree before I set the selectedItem ?

 
Replies
  • Currently Being Moderated
    Oct 16, 2011 12:13 AM   in reply to eprevot123

    Thanks, you saved my day!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 15, 2011 8:49 AM   in reply to eprevot123

    Thanks for this, I have the same problem. Hopefully this workaround fixes it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2012 6:09 AM   in reply to eprevot123

    I have the exact same problem but tree.validateProperties() has not fixed the problem!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2012 6:20 AM   in reply to kkudiksx

    Indeed, for me neither. What I then did was use selectedIndex instead of selectedItem and that seemed to help.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2012 6:35 AM   in reply to eprevot123

    hm I ll give it a go and let you know!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2012 6:50 AM   in reply to eprevot123

    selectedIndex worked for me! Thank you so much Wim!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2012 7:09 AM   in reply to eprevot123

    I'm using callLater so I don't think I will have any inconsistencies. I may be wrong though.

     

    In Flex 3.2 selectedItem = item worked. So it might be a Flex 3.* where * > 2 or a Flex 4 bug.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points