3 Replies Latest reply on Feb 20, 2007 6:45 AM by Dzihan

    The case of the mysterious non-expanding tree.

    ctzn99
      Hello all,

      I've got a strange problem that I can't figure out. At it's simplest, i've got a tree and two xml objects. In mx tag for the tree I define one of the xml objects as the dataprovider, additionally i've defined an event handler for the trees creationComplete event that opens up the root nood. This works great and is exactly what I want.

      But...

      I've also got a button, click on the button and it either a) changes the dataprovider of the tree to the second xml object, or b) change the xml in the dataprovider already assigned. Then, because the data has changed and the tree re-renders it ends up collapsed again so immediately after changing it's data I try to open the root node but nothing happens. No errors, just nothing.

      For the purpose of debugging i added a second button that simply tries to expand the root node of the tree after i've changed the trees data provider and it works fine. The line of code that exists in both the first and second buttons and that should open the tree only works in the second button for some reason. The only thing I can think of is timing, perhaps when trying to expand the node in the line of code directly following the change to the dataprovider the data hasn't loaded into the tree yet so it can't expand the node but, i've tried all sorts of event handlers and they don't seem to work either.

      Here's a link if someone wants to download my test.mxml file and try it themselves. There's more comments in the code but it's a super simple test page so it should be immediate where the problem is...

      http://www.binarydemon.com/test.mxml

      Thanks in advance.
      Zach