This is a migrated thread and some comments may be shown as answers.

Determine if node is root node

1 Answer 229 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andrew Short
Top achievements
Rank 1
Andrew Short asked on 28 Mar 2008, 04:58 PM
What is the easiest way to tell if a give node is a root node or not on the client side.  With the classic RadControls, I did this by using

if (node.Parent) { ...

This would return nothing if node was a root node, and a reference to the parent node if not.  With the Prometheus controls, however, if node is a root node, node.get_parent() returns a reference to the treeview itself, which means I need to convert code with this logic.  I'm just looking for the simplest way to do this.
Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 28 Mar 2008, 05:32 PM
Hello Andrew Short,

I suggest that you use the following check instead:

if(node.get_level() == 0)

or

if(node.get_parent() == node.get_treeView())

Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Andrew Short
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or