Hi everyone,
I didn't succeed in using the javascript function node.collapse() in the OnClientNodeExpanded event. Please, find below my code sample :
The node ExpandMode is ServerSideCallBack. When I run my application, The toggle mark is hide but the node is not collapsed. Is it normal to not be able to use the node.Collapse() method in this event ?
I'm really not be able to compute the number of children of the nodes like in your Demo before trying to expand it. I consume data from another application and it's pretty long for each node. So I need to collapse the node and hide the toggle element after the expand depending on the number of children.
Reagrds,
Sebastien
I didn't succeed in using the javascript function node.collapse() in the OnClientNodeExpanded event. Please, find below my code sample :
| ASPX : |
| <telerik:RadTreeView ID="TreeView1" runat="server" PersistLoadOnDemandNodes="true" Skin="Black" OnNodeClick="RadTreeView1_SelectedNodeClick" OnNodeExpand="RadTreeView1_NodeExpand" OnClientNodeExpanded="ClientNodeExpanded" /> |
| JAVASCRIPT : |
| <script type="text/javascript" language="javascript"> |
| function ClientNodeExpanded(sender, eventArgs) |
| { |
| var node = eventArgs.get_node(); |
| if (node.get_nodes() == null |
| || node.get_nodes().get_count() == 0) |
| { |
| node.collapse(); |
| var toggleElement = node.get_toggleElement(); |
| if (toggleElement) |
| toggleElement.style.display = "none"; |
| } |
| } |
| </script> |
The node ExpandMode is ServerSideCallBack. When I run my application, The toggle mark is hide but the node is not collapsed. Is it normal to not be able to use the node.Collapse() method in this event ?
I'm really not be able to compute the number of children of the nodes like in your Demo before trying to expand it. I consume data from another application and it's pretty long for each node. So I need to collapse the node and hide the toggle element after the expand depending on the number of children.
Reagrds,
Sebastien