Expanding issue in checkbox

7 posts, 0 answers
  1. Blair
    Blair avatar
    13 posts
    Member since:
    Mar 2013

    Posted 13 Jul 2014 Link to this post

    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
  2. Faten
    Admin
    Faten avatar
    7 posts

    Posted 13 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Blair
    Blair avatar
    13 posts
    Member since:
    Mar 2013

    Posted 13 Jul 2014 in reply to Faten Link to this post

    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


  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 16 Jul 2014 Link to this post

    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.

     
  6. Blair
    Blair avatar
    13 posts
    Member since:
    Mar 2013

    Posted 16 Jul 2014 in reply to Atanas Korchev Link to this post

    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
  7. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 17 Jul 2014 Link to this post

    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.

     
  8. Blair
    Blair avatar
    13 posts
    Member since:
    Mar 2013

    Posted 17 Jul 2014 in reply to Alex Gyoshev Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready