Child node doesn't be checked unless expend it or check twice

3 posts, 0 answers
  1. JC Software Services, Inc.
    JC Software Services, Inc. avatar
    4 posts
    Member since:
    Jul 2015

    Posted 31 Aug 2015 Link to this post

    I use TreeViewBuilder.Items to build tree view.
    Child nodes doesn't ​be checked when I check parent node without expend nodes, but if I check ​the parent node again(without expend too), child nodes will be checked.

    @using Kendo.Mvc.UI.Fluent;
    @model List<AuthViewModel>
    @functions
    {
        public static void ShowTree(TreeViewItemFactory helper, IEnumerable<AuthViewModel> nodes)
        {
            foreach (var node in nodes)
            {
                helper.Add()
                    .Id(node.ID)
                    .Text(node.NAME)
                    .Checked(node.IsChecked)
                    .Expanded(false)
                    .Items(items =>
                    {
                        if (node.Childs.Count() > 0)
                        {
                            ShowTree(items, node.Childs);
                        }
                    });
            }  
        }
    }
     
    @(Html.Kendo().TreeView()
        .Name("authTree")
        .Checkboxes(checkboxes => checkboxes
            .Name("checkedFiles")
            .CheckChildren(true)
        )
        .Items(root =>
            {
                ShowTree(root, Model);
            }
        )
    )

  2. JC Software Services, Inc.
    JC Software Services, Inc. avatar
    4 posts
    Member since:
    Jul 2015

    Posted 31 Aug 2015 in reply to JC Software Services, Inc. Link to this post

    It is something wrong in my post.

    1. I mean expand not expend.
    2. If I check the parent node after expand the child node, it still not check the child node too.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 02 Sep 2015 Link to this post

    Hello,

    The described behavior indicates that the initial state is invalid - the parent node is checked but not all of its children are checked. If this is the case then you should change the initial parent state to false or make all children checked.

    Regards,
    Daniel
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top