4 Replies Latest reply on Apr 20, 2009 8:56 AM by mickey3

    auto select new item in tree

    mickey3

      Hi

       

      I have a tree that i allow user to drag and drop items to it - what is the easiest way so the new item is automatically selected? ie, tree.selectedIndex should point to the new item's index.

       

      Unfortunately it thought this was easy apparently it was not - like if the nodes in the tree control are collapsed, the selectedIndex is different than when all the nodes are expanded.

       

      Do note that the way i populate my tree is through a data provider - so i populate a class that would become the tree's data provider, so when the tree refreshes, i simply do this:

       

      myTree.dataProvider = project.p;   

       

      I can track where my new item was inserted in my "project" instance - but like i said earlier, the tree itself have different selectedIndex when the nodes are collapsed and when they are not.

       

       

      THanks