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

CheckChildren(true) Issue

1 Answer 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sean Mars
Top achievements
Rank 1
Sean Mars asked on 29 Aug 2013, 09:11 PM
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. 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Sep 2013, 07:04 AM
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!
Tags
TreeView
Asked by
Sean Mars
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or