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

Setting the Id configuration of a TreeView node does not add the data-id attribute #7128

Closed
aleksandarevangelatov opened this issue Nov 25, 2022 · 0 comments
Assignees

Comments

@aleksandarevangelatov
Copy link
Contributor

aleksandarevangelatov commented Nov 25, 2022

Bug report

The TreeView rendering in UI for ASP.NET MVC and UI for ASP.NET Core are not consistent. Setting the Id configuration for an item in UI for ASP.NET MVC renders a data-id attribute, that is missing in UI for ASP.NET Core.

Reproduction of the problem

  1. Use the following TreeVIew definition
@(Html.Kendo().TreeView()
        .Name("treeview-kendo")
        .TemplateId("treeview")
        .Checkboxes(c=>c.CheckChildren(true))
        .Items(treeview =>
        {
            treeview.Add()
                .Text("My Documents")
                .Id("MyId1");

            treeview.Add()
                .Text("My Documents 2")
                .Id("MyId2");                
        })
)

Current behavior

When using the UI for ASP.NET Core the rendered <li> element does not have the data-id attribute that is present in UI for ASP.NET MVC

<li role="treeitem" class="k-item k-treeview-item k-first" data-uid="a3c937fd-1c4a-46a6-81e1-e53e1a2aeb6e" aria-checked="false" aria-selected="false" aria-expanded="false" data-expanded="false" aria-setsize="2" aria-level="1">
  <div class="k-treeview-top k-treeview-top">
    <span class="k-checkbox-wrapper" role="presentation">
      <input id="_a3c937fd-1c4a-46a6-81e1-e53e1a2aeb6e" aria-hidden="true" type="checkbox" tabindex="-1" class="k-checkbox k-checkbox-md k-rounded-md">
    </span>
    <span class="k-treeview-leaf k-in">
      <span class="k-treeview-leaf-text">My Documents</span>
    </span>
  </div>
</li>

Expected/desired behavior

Rendering should be consistent and the data-id attribute added in UI for ASP.NET Core.

Workaround

Use the HtmlAttributes configuration to add the data-id attribute

treeview.Add()
    .HtmlAttributes(new {data_id = "MyId1"})
    .Text("My Documents")
    .Id("MyId1");

Environment

  • Kendo UI version: 2022.3.1109
  • Browser: [all]
  • Further details available in ticket 1588455
@github-actions github-actions bot added the FP: Unplanned Sync status with associated Feedback Item label Nov 25, 2022
@aleksandarevangelatov aleksandarevangelatov self-assigned this Aug 31, 2023
@github-actions github-actions bot added FP: Completed Sync status with associated Feedback Item and removed FP: Unplanned Sync status with associated Feedback Item labels Oct 12, 2023
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

2 participants