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

Expanding issue in checkbox

6 Answers 75 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Blair
Top achievements
Rank 1
Blair asked on 13 Jul 2014, 11:56 PM
Hi,

I just found a problem after I successfully loaded data from the controller.

The problem is clearly described in the attached picture.

Could anyone could help me solve this please?

Thanks and regards,

Charles

6 Answers, 1 is accepted

Sort by
0
Faten
Telerik team
answered on 14 Jul 2014, 12:09 AM
Hello Blair,

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.

 
0
Blair
Top achievements
Rank 1
answered on 14 Jul 2014, 12:53 AM
Hi Faten,

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


0
Atanas Korchev
Telerik team
answered on 16 Jul 2014, 06:30 AM
Hi,

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.

 
0
Blair
Top achievements
Rank 1
answered on 17 Jul 2014, 12:44 AM
Hi Atanas,

Sorry about the previous screenshot. I made a new one I think it is more clear than the previous one.

Thanks and regards,

Charles
0
Alex Gyoshev
Telerik team
answered on 17 Jul 2014, 09:02 AM
Hello Blair,

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.

 
0
Blair
Top achievements
Rank 1
answered on 17 Jul 2014, 11:14 PM
Hello Alex,

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
Tags
TreeView
Asked by
Blair
Top achievements
Rank 1
Answers by
Faten
Telerik team
Blair
Top achievements
Rank 1
Atanas Korchev
Telerik team
Alex Gyoshev
Telerik team
Share this question
or