Here some piece of code... Where I load through javascript and my own webservice call a treeview. In my collection of objects, I know
how many children I have for each item. If obj.Children > 0 I would like to show the Expand Icon. I don't see in the documentation how I can do that, the expand thing is only shown if I seed the expand mode WebService, but in this case it complains no WebService is configured... So it would be cool if I could find a solution.
if (obj.Children > 0) {
node.set_expandToSOMETHING
}
var
tree = $find(
this
.treeviewId);
var
parentNode =
null
;
if
(parentId != 0) {
parentNode = tree.findNodeByValue(parentId);
}
for
(
var
x = 0; x < result.Result.length; x++) {
var
obj = result.Result[x];
var
node =
new
Telerik.Web.UI.RadTreeNode();
node.set_text(obj.Display);
node.set_value(obj.KeywordId);
node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.ClientSide);
if
(obj.Children > 0) {
node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.ClientSide);
}
if
(parentId != 0) {
parentNode.get_nodes().add(node);
}
else
{
if
(obj.ParentKeywordId == 0) {
tree.get_nodes().add(node);
}
else
{
var
parentNode = tree.findNodeByValue(obj.ParentKeywordId);
parentNode.get_nodes().add(node);
}
}
}
tree.commitChanges();
if
(parentId != 0) {
parentNode.set_expanded();
}