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

[Solved] RadTreeView javascript to see if node may have children

2 Answers 216 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 26 Feb 2008, 12:48 AM

I am using a RadTreeView with TreeNodeExpandMode.ServerSideCallBack (an AJAX call fills in the tree entries when the plus is clicked. For each RadTreeNode, you can specifiy an ExpandMode of TreeNodeExpandMode.ServerSideCallBack to make the plus show up. Or leave it so that no plus shows up.

In client Javascript (from the OnClientNodeClicking callback), how do I tell if there are any "possible" children (if the plus is visisble)? The children are not yet filled in -- I call node.expand() to expand the node when clicked.

Thanks

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 26 Feb 2008, 07:46 AM
Hello Jay,

You can get the ExpandMode of a node, like:
var tree = $find("<%=RadTreeView1.ClientID %>"); 
var firstNode = tree.get_nodes().getNode(0); 
if(firstNode.get_expandMode()==2) 
  alert("this node is supposed to have child nodes"); 

If the get_expandMode() method returns 2, then the ExpandMode of the node has been set to ServerSideCallback. Hence, the node is supposed to have child nodes.

Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jay
Top achievements
Rank 1
answered on 26 Feb 2008, 06:32 PM
Perfect!

Thanks!
Tags
TreeView
Asked by
Jay
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Jay
Top achievements
Rank 1
Share this question
or