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

Problem with collapsing tree node on client side

1 Answer 59 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jaimin
Top achievements
Rank 1
Jaimin asked on 31 Jul 2008, 12:00 PM
Hi,

I faced a problem while collapsing node on client side. Consider following example: There are 3 root nodes in the tree when I click on collapse button the below function executes but it only collapses the first expanded node. The below function is taken from the Rad examples only...
Secnario:
R1
    C1R1
    C2R2
R2
    C1R2
    C2R2
R3
    C1R3

When I click on collapse button only first node collapses and tree looks like:
R1
R2
    C1R2
    C2R2
R3
    C1R3

When I again click on collapse button second node collapses and tree looks like:
R1
R2
R3
    C1R3


function

Collapse()

{

//get the explorer tree

var explorerTree = $find("<%= rtvExplorer.ClientID %>");

//get the root node count

var nodeCount = explorerTree.get_nodes().get_count();

//loop through root node and collapse them

for (var loopCount=0; loopCount<nodeCount; loopCount++)

{

var node = explorerTree.get_nodes().getNode(loopCount);

alert("node text : " + node.get_text() + ", loopCount : " + loopCount + ", nodeCount : " + nodeCount);

node.set_expanded(

false);

}

//for

}

//function [Collapse]

Has anyone came across with this situation and found the solution???

Thanks and Regards,
Jaimin

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 01 Aug 2008, 02:42 PM
Hello Jaimin,

I tested with the provided code and everything worked normally. Please see the attached page as an example.

Does it work on your end? Could you modify it appropriately, so that it behaves as described in the first place?

Kind regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Jaimin
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or