I have a RadTreeView that loads nodes on demand via a web service. Only the node at the very bottom level has a value, which is what I need to retrieve. If the user checks a node and then expands it, it's children will be checked all the way to the lowest level, and the value will be provided. However, here is my problem: When the user selects a parent node (that is NOT expanded) I cannot figure out how to get the value of its children's lowest level nodes. Essentially, when a node is selected I need it to retrieve and check all of its children. Is this possible?
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 11 Jun 2013, 01:45 PM
Hi,
Try the following code.
JS:
Thanks,
Shinu.
Try the following code.
JS:
function
OnClientNodeClicked(sender, args)
{
var
currentNode = args.get_node();
if
(args.get_node()._hasChildren())
{
var
allNodes = currentNode.get_allNodes();
if
(currentNode.get_checked())
{
for
(
var
i = 0; i < allNodes.length; i++)
{
allNodes[i].set_checked(
false
);
currentNode.set_checked(
false
);
}
}
else
{
for
(
var
i = 0; i < allNodes.length; i++)
{
allNodes[i].set_checked(
true
);
currentNode.set_checked(
true
);
}
}
alert(args.get_node().get_lastChild().get_text());
// to get the last node of selected parent.
}
}
Thanks,
Shinu.
0
Logan
Top achievements
Rank 1
answered on 11 Jun 2013, 02:26 PM
Shinu,
Thank you for the reply. The problem I am having with the code you provided is that:
returns false until the node is expanded and its children are loaded from the web service. This is the main problem that I am running into. My original idea was to force the node to expand, however .ExpandChildNodes() does not work with web service load on demand, and I cannot find any way to expand a node programatically.
.
Thank you for the reply. The problem I am having with the code you provided is that:
args.get_node()._hasChildren()
returns false until the node is expanded and its children are loaded from the web service. This is the main problem that I am running into. My original idea was to force the node to expand, however .ExpandChildNodes() does not work with web service load on demand, and I cannot find any way to expand a node programatically.
.
0
Shinu
Top achievements
Rank 2
answered on 12 Jun 2013, 04:39 AM
Hi,
To expand a node programatically please have a look into the following help documetation.
Load On Demand expand on server-side Node click
Thanks,
Shinu.
To expand a node programatically please have a look into the following help documetation.
Load On Demand expand on server-side Node click
Thanks,
Shinu.
0
Logan
Top achievements
Rank 1
answered on 17 Jun 2013, 08:59 PM
Is it possible to expand the node being clicked AND the nodes that are being loaded from node.expand()?
0
Hello Logan,
Please try using the approach described in this help article - Expanding Nodes on a Single Click
Regards,
Kate
Telerik
Please try using the approach described in this help article - Expanding Nodes on a Single Click
Regards,
Kate
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.