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

Changing CheckChildNodes property in the client side

4 Answers 81 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
NLV
Top achievements
Rank 1
NLV asked on 12 Mar 2010, 10:29 AM
Hello
I want to change the CheckChildNodes property of the treeview in the client side in multiple situations when particular nodes are clicked. How can i do that?

Regards
NLV

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Mar 2010, 11:53 AM

Helo,

I tried the following client code in order to set the CheckChildNodes property from client.

JavaScript:

 
function setProperty() {  
        var treeView = $find('<%=RadTreeView1.ClientID%>');  
        treeView._checkChildNodes = false// Set the value  
    } 

Regards,

Shinu.

0
Veronica
Telerik team
answered on 12 Mar 2010, 12:53 PM
Hi NLV,

Please take a look at this help topic. In the bottom of the page is presented some way to check all child nodes when checking their parent in Javascript:

var expandedNodeChecked = null;
         
function onClientNodePopulated(sender, eventArgs)
{
if (expandedNodeChecked != null)
{
 var parentNode = eventArgs.get_node();
 var childNodes = parentNode.get_nodes();
 var childNodeCount = childNodes.get_count();
   
 for (var nodeIndex = 0; nodeIndex < childNodeCount; nodeIndex++)
 {
  var childNode = childNodes.getNode(nodeIndex);
    
  childNode.set_checked(expandedNodeChecked);
 }
}
}
function onClientNodePopulating(sender, eventArgs)
{
expandedNodeChecked = eventArgs.get_node().get_checked();
}


Regards,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
NLV
Top achievements
Rank 1
answered on 12 Mar 2010, 04:28 PM
Hi Veronica Milcheva

Thanks for your reply. But i think looping is not gonna work if the childeNodeCount is very large.

@shinu - Let me try out the solution you gave. I previously tried it as

$find('<%=RadTreeView1.ClientID%>').CheckChildNodes = false 




and it dint work!

Regards
NLV
0
NLV
Top achievements
Rank 1
answered on 15 Mar 2010, 01:30 PM
Thanks Shinu. Your solution worked.

Cheers!

NLV
Tags
TreeView
Asked by
NLV
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Veronica
Telerik team
NLV
Top achievements
Rank 1
Share this question
or