6 Answers, 1 is accepted
Sorry to hear that you are having a problem with the TreeView.
Is your sample based on this demo one?
http://demos.telerik.com/aspnet-mvc/treeview/checkboxes
If possible, can you provide us please with a small working sample that will replicate this issue?
Thanks in advance,
Regards,
Faten
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thanks for your reply.
These are the main codes in view:
<script type="text/javascript">
$("#ActivityPermissionTreeview").kendoTreeView({
dataSource: new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "LoadActivityPermissions?userID=@ViewBag.userID",
dataType: "json"
}
},
schema: {
model: {
id: "id",
children: "items"
}
}
}),
dataTextField: "text",
checkboxes: {
checkChildren: true
}
});
</script>
And the codes in controller are:
public JsonResult LoadActivityPermissions(int userID)
{
List<PermissionModel> permissionTreeList = new List<PermissionModel>();
permissionTreeList = service.getPermissionTreeList();
return Json(permissionTreeList, JsonRequestBehavior.AllowGet);
}
The PermissionModel is defined:
public class PermissionModel
{
public int id { get; set; }
public string text { get; set; }
public bool expanded { get; set; }
public bool @checked { get; set; }
public string spriteCssClass { get; set; }
public List<PermissionModel> items { get; set; }
}
I think the JSON data from controller is correct so that the tree can be loaded successfully and correctly.
Thanks and regards,
Charles
Unfortunately we are still not sure what the actual problem is. Could you please explain what "wrong expanding means"? The screenshot shows that the child nodes of the expanded nodes are visible which makes it hard to understand what is wrong in this case.
Regards,
Atanas Korchev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Does this Dojo snippet work as expected? The TreeView distinguishes between a node that has been clicked by the user and a node that hasn't, and propagates the state if there is no checked state coming from the server. If the server serializes the checked state, there is a collision between what the user has done and what the user reports, and one of the states is ignored.
Regards,Alex Gyoshev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thank you for your reply. That makes sense. I have added one function in the scripts to handle this and it worked fine.
Thanks and regards,
Charles