Hi,
Here is my scenario. I have a two level tree : one root node with one level of child node. The child node are loaded on demand by configuring the root node to ServerSideCallBack.
My goal is to combine the setting check box action with the loading child nodes on demand. Means that when i check the root node, it will load on demand all the child nodes and set its child nodes to checked.
currently i am using these code snippet which is triggered on client side event : OnClientNodeChecked. It will trigger DoCientNodeChecked event.
All the root nodes are configured with ExpandMode = TreeNodeExpandMode.ServerSideCallBack. so the workaround is expand the current node using client side method using set_expanded(true). But since it's working asynchronously, the next method which is "var isChecked = eventArgs.get_node().get_checked();" is executed directly.
May i know how to wait or check whether all the child nodes has been loaded successfully, before traversing the child nodes ?
Thanks
hadi teo
Here is my scenario. I have a two level tree : one root node with one level of child node. The child node are loaded on demand by configuring the root node to ServerSideCallBack.
My goal is to combine the setting check box action with the loading child nodes on demand. Means that when i check the root node, it will load on demand all the child nodes and set its child nodes to checked.
currently i am using these code snippet which is triggered on client side event : OnClientNodeChecked. It will trigger DoCientNodeChecked event.
function UpdateAllChildren(nodes, checked) | |
{ | |
var i; | |
for (i=0; i<nodes.get_count(); i++) | |
{ | |
if (checked) | |
{ | |
nodes.getNode(i).check(); | |
} | |
else | |
{ | |
nodes.getNode(i).set_checked(false); | |
} | |
if (nodes.getNode(i).get_nodes().get_count()> 0) | |
{ | |
UpdateAllChildren(nodes.getNode(i).get_nodes(), checked); | |
} | |
} | |
} | |
function DoClientNodeChecked(sender, eventArgs) | |
{ | |
debugger | |
if(!eventArgs.get_node().get_expanded()) | |
{ | |
eventArgs.get_node().set_expanded(true); | |
} | |
var childNodes; | |
while(eventArgs.get_node().get_nodes() == null) | |
{ | |
childNodes = eventArgs.get_node().get_nodes(); | |
} | |
var isChecked = eventArgs.get_node().get_checked(); | |
UpdateAllChildren(childNodes, isChecked); | |
} |
All the root nodes are configured with ExpandMode = TreeNodeExpandMode.ServerSideCallBack. so the workaround is expand the current node using client side method using set_expanded(true). But since it's working asynchronously, the next method which is "var isChecked = eventArgs.get_node().get_checked();" is executed directly.
May i know how to wait or check whether all the child nodes has been loaded successfully, before traversing the child nodes ?
Thanks
hadi teo