Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropDownTree with remote binding does not truly selects inner checked items #7969

Open
eyupyusein opened this issue Sep 11, 2024 · 0 comments

Comments

@eyupyusein
Copy link
Contributor

Bug report

The DropDownTree component provides built-in CheckBoxes. It also has the internal checked property which should initially check individual items. But in the scenario below, the inner items are not truly getting selected.

Reproduction of the problem

  1. Create a new Core page.
  2. Add the DropDownTree definition:
@using Kendo.Mvc.UI

@(Html.Kendo().DropDownTree()
        .Name("dropdowntree")
        .DataTextField("Name")
        .Checkboxes(true)
        .AutoClose(false)
        .DataSource(dataSource => dataSource
            .Read(read => read
                .Action("Remote_Data_Binding_Get_Employees", "Home")
            )
        )
    )
  1. Create the model and add the data in the controller:
    public class Employee
    {
        public int EmployeeID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int? ReportsTo { get; set; }
        public bool Expanded { get; set; }
        public bool Checked { get; set; }
    }
    public JsonResult Remote_Data_Binding_Get_Employees(int? id)
    {
        var source = new List<Employee>();
        source.Add(new Employee() { EmployeeID = 1, FirstName = "Name", LastName = "1", Expanded = true });
        source.Add(new Employee() { EmployeeID = 2, FirstName = "Name", LastName = "2", Checked = true });
        source.Add(new Employee() { EmployeeID = 3, FirstName = "Name", LastName = "3", ReportsTo = 1, Checked = true });

        var employees = from e in source
                        where (id.HasValue ? e.ReportsTo == id : e.ReportsTo == null)
                        select new
                        {
                            id = e.EmployeeID,
                            expanded = e.Expanded,
                            @checked = e.Checked,
                            Name = e.FirstName + " " + e.LastName,
                            hasChildren = (from q in source
                                           where (q.ReportsTo == e.EmployeeID)
                                           select q
                                           ).Count() > 0
                        };

        return Json(employees);
    }
  1. The inner item is visually selected, but in reality - it's not. The input does not show it and also the .value() method does not include it:

image

@github-actions github-actions bot added the FP: Unplanned Sync status with associated Feedback Item label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant