This is a migrated thread and some comments may be shown as answers.
Expand ancestors
1 Answer 4 Views
This is a migrated thread and some comments may be shown as answers.
Alyssa
Top achievements
Rank 1
Alyssa asked on 19 Jun 2014, 07:50 AM
Hi,
I have a treeview and a textbox for search. I am able to get the searched node from the treeview. But I need to expand all the ancestors of that node.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 19 Jun 2014, 08:00 AM
Hi Alyssa,

Try the following javascript function to expand ancestor nodes.

function expandAllAncestors(node) {
       if (node.get_expanded() !== true)
            node.expand();
           if (node.get_level() != 0) {
               expandAllAncestors(node.get_parent());
           }
       }

Thanks,
Shinu.
Asked by
Alyssa
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or