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

Checkboxes below the expanded node lose their state

1 Answer 200 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 08 Sep 2018, 09:15 PM

Hi,

 

I'm using the MVC TreeList with remote data loading.I have the latest column to be a checkbox, but I have an issue when the node is expanded. After expanded, all of the nodes below in the same tier get unchecked, even if they were checked before that. Here is a video of the problem.

https://www.screencast.com/t/zt234VFtdLEO

Am I doing something wrong?

This is the code for the tree list:

        @(Html.Kendo().TreeList<TreeEntity<Organization>>()
                                                                                                .Name("treelist")
                                                                                                .Columns(columns =>
                                                                                                {
                                                                                                    columns.Add().Field(e => e.Value.Id).Width(280).Title("ORG ID");
                                                                                                    columns.Add().Field(e => e.Value.Name).Width(280).Title("ORGANIZATION NAME");
                                                                                                    columns.Add().Field(e => e.Value.ActiveFlag).Width(60).Title("ACTIVE");
                                                                                                    columns.Add().Width(60).Title("SELECT").TemplateId("cbx-template");
                                                                                                })
                                                                                        .DataSource(dataSource => dataSource
                                                                                            .Read(read => read.Action("OrganizationsTree_Read", "Home"))
                                                                                            .Model(m =>
                                                                                            {
                                                                                                m.Id(f => f.Id);
                                                                                                m.ParentId(f => f.ParentId).DefaultValue(null);
                                                                                                m.Field(f => f.Value.Id);
                                                                                                m.Field(f => f.Value.ParentId);
                                                                                            })
                                                                                            )
                                                                                            .Events(events => { events.DataBound("onTreeDataBound"); events.Expand("onTreeExpand"); })
                                                                                .Height(540)
        )

 

DataBound and Expand are JS methods without any code except console.log(arg).

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Sep 2018, 07:57 AM
Hi Adam,

For others with similar issue, I am sharing the answer from the support ticket that you have opened:

"Although that the code for the template with the checkbox is missing in the code snippet, I would guess that there is no two-way binding between the dataItem and the checkboxes, which means that each time a node is expanded or collapsed, all records after the expand/collapse point will be rendered again with the value present in the underlying dataItem (the initial value) or the initial template. This is the expected behavior and there is no suitable solution that we could recommend.

Nevertheless, you could take a look at the following HowTo example and re-use the client-side logic for persisting the checked state of the checkboxes:
https://docs.telerik.com/kendo-ui/controls/data-management/treelist/how-to/show-a-checkbox-column "



Best Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeList
Asked by
n/a
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or