I have an AJAX enabled application that uses the WebTree and works well. However, I am adding search capability that requires the use of javascript on the client to react to a row onclick event on a table. I wrote a javascript function to handle the click event and search my tree to get to the correct node. However, I want to force a partial postback to that the UltraWebTree_NodeClick event is fired. I would think that using .NeedPostBack = true; would work, but nothing seems to happen. Please see my code below.
function SetNode(cat1, cat2, cat3){ var tree = igtree_getTreeById("UltraWebTree1"); var nodes = tree.getNodes(); for (var i = 0; i < nodes.length; i++){ if (nodes.getDataKey() == cat1){ nodes = nodes.getChildNodes(); for (var x = 0; x < nodes.length; x++){ if (nodes[x].getDataKey() == cat2){ nodes = nodes[x].getChildNodes(); for (var y = 0; y < nodes.length; y++){ if (nodes.getDataKey() == cat3){ //Found IT! nodes.setSelected(true); //Force the post back! tree.NeedPostBack = true; }; }; }; }; }; }; }
Ideally the user would not see the postback - it would be exactly as if the user had clicked on the themselves.
Thanks,
Rob
Setting the selected node should fire the SelectedNodeChanged event on the server side.
Let's back up though. What functionality are you trying to acheive? What is the actual behavior you're trying to implement?
-Tony
Setting the selected node is not having the same reaction (server method called) as clicking the node with the mouse.
You can select a node from the client-side using the CSOM's tree.setSelectedNode method (http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WebTree_Object_CSOM.html).
I am trying to do a similar thing for part of my application, but shoehorning another panel in underneath the tree is going to be a significant effort. Is there any way to do a node.click(); or similar client function?
Hi Rob,
I would use the WARP panel in this scenario. Place the Tree in a WARP panel, and use the Warp's .refresh client-side function to force a partial refresh.