0 Replies Latest reply on Jul 17, 2008 10:03 PM by jonesf

    Expanding all nodes in tree by default

    jonesf

      State A (no tree control)
      State B (has tree control "TC")

      The way I make the TC 'default' to having all nodes expanded is by doing something like this...
      <mx:tree dataProvider="{myDP}" creationComplete="{TC.expandChildrenOf(myDP);}"/>
      This works... sort of.

      So here's the scenario.
      User goes into State A, clicks a button (this sets myDP to a new object) and goes into State B. The TC is there, fully expanded, beautiful. Now the user goes back to State A, selects a new link (a new value is assigned to myDP) and goes back into State B again. But this time, the TC is not expanded, it is collapsed.

      The reason is that creationComplete only happens on the very first entry into the state and the objects in that state are stored in memory forever (this behavior will haunt me forever) so the TC only gets created once... which is where I have the expand code.

      No problem, just expand the TC in the enterState event for State B, right? Wrong, it doesn't work. I don't know why but it just doesn't work. I'm guessing it's too early in the event cycle and just doesn't take. I can add a button and click that to expand the whole tree but the point is for it to be automatic. I cannot find any events that will let me reliably do this given the scenario above.

      Any ideas?
      Thanks