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

[Solved] Trigger OnClientNodeClicking via script?

1 Answer 161 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
N
Top achievements
Rank 1
N asked on 28 Feb 2008, 01:55 AM
Is there a way to programmatically trigger the OnClientNodeClicking() event via Javascript?

I tried tree.raise_nodeClicked(nodeIndex) but this seems to do nothing. Is there a node method that does this like node.click() ?

1 Answer, 1 is accepted

Sort by
0
N
Top achievements
Rank 1
answered on 28 Feb 2008, 04:12 AM

Actually, I think I've worked it out (unless there is a better way):

// function to simulate a treenode click  
function ClickOnNode(id) {  
  var node = MyTree.findNodeByValue(id);  
  
  //expand all parent nodes  
  var p = node.get_parent();  
  while (p != null) {  
    if (p.get_parent() != null) p.expand(); //expand if parent is not tree  
    p = p.get_parent();  
  }  
  
  onTreeClicking(MyTree, new Telerik.Web.UI.RadTreeNodeEventArgs(node))  
  node.select();  
}  
  
  
//MyTree OnClientNodeClicking() event handler:  
function onTreeClicking(tree, args){  
  var node = args.get_node();  
  // Your code to process the click event  
}  

Tags
TreeView
Asked by
N
Top achievements
Rank 1
Answers by
N
Top achievements
Rank 1
Share this question
or