CheckChildren(true) Issue

2 posts, 0 answers
  1. Sean Mars
    Sean Mars avatar
    10 posts
    Member since:
    Jan 2007

    Posted 29 Aug 2013 Link to this post

    When you run the sample project, you will notice that even though I have item with Id="1" checked, it does not render checked in the UI.

    In the View I have:
    .CheckChildren(true) // If change to CheckChildren(false) the issue goes away

    In the controller I have:
                model.CheckedNodes = new List<TreeViewItemModel>()
                    {
                        new TreeViewItemModel()
                        {
                            HasChildren = true,
                            Checked = true, // SUPPORT: This is checked here, but because it has children it does not render CHECKED in UI
                            Id="1",
                            Text = "A - this does not obey Checked attribute",
                            Items = new List<TreeViewItemModel>(){new TreeViewItemModel(){Id = "2",Text = "B"}}
                        },                    new TreeViewItemModel()
                        {
                            HasChildren = false,
                            Checked = true,
                            Id="3",
                            Text = "C",
                        },
                    };

    Create a new Kendo UI MVC project named "SampleKendoUITreeViewIssue" and drop the attached directories in the root of the project. 
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 03 Sep 2013 Link to this post

    Hello,

    The parent node is unchecked because the children of the node are unchecked. Since there is no valid state in which the parent is checked but the children are unchecked when the checkChildren option is enabled, the parent is unchecked during the initialization. You should either set the Checked property to true to child or disable the checkChildren option in order for the parent to be checked.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top