2 Replies Latest reply on Oct 25, 2006 7:59 AM by rmarp

    Binding to Tree.selectedItem not working properly

    rmarp Level 1
      I've been having problems using the Tree component in my application so I've isolated the issue into a new project. I've got a tree and a label. The tree is bound to some sample nodes. The label is bound to myTree.selectedItem. When I click on various tree nodes with my mouse, the label shows the selectedItem changing properly. But when I need to do is set the selectedItem programatically. When I do this, it does in fact change the property (which I can see via the debugger) but the label that's bound to it doesn't pick up the new value and the tree itself doesn't even repaint itself to show that new node being highlighted. It appears this is happeneing because the tree component only seems to fire the change event when the selection is changed through the user interface, not through code. Can this be the intended design? This seems like a big limitation to me... Has anybody come across this problem and if so, how did you deal with it?

      Thanks folks!

      Ryan
        • 1. Re: Binding to Tree.selectedItem not working properly
          ntsiii Level 3
          How are you updating the dataProvider?

          For that matter, what is the dataType of the dataProvider? e4x XML? that is the best. If you use e4x API, the tree should update itself.

          Post a sample app.

          Tracy
          • 2. Re: Binding to Tree.selectedItem not working properly
            rmarp Level 1
            Hi Tracy,

            The dataProvider is a hierarchical Object collection. I've since played with this and got it working via a workaround. But basically the issue is that the tree only seems to dispatch the change event when the selection is changed through user interaction, and not when the selectedItem property is set programatically. I worked around it by deriving from the Tree class and creating a new property called codeSelectedItem and then firing the change event in the setter.

            Ryan