kendo-ui-core icon indicating copy to clipboard operation
kendo-ui-core copied to clipboard

Add support for HtmlAttributes, ContentHtmlAttributes, ImageHtmlAttributes and LinkHtmlAttributes

Open kendo-bot opened this issue 4 years ago • 4 comments

Bug report

The attributes set through the "HtmlAttributes", "ContentHtmlAttributes", and "LinkHtmlAttributes"methods are not applied to the TreeView items.

Reproduction of the problem

  1. Create a TreeView and set attributes by using the "HtmlAttributes", "ContentHtmlAttributes", "LinkHtmlAttributes"methods:
@(Html.Kendo().TreeView()
    .Name("treeview-kendo2")
    .Items(treeview =>
    {
        treeview.Add().Text("My Documents")
        .SpriteCssClasses("k-icon k-i-globe")
        .Expanded(true)
        .Url("/")
        .HtmlAttributes(new { @class = "fairydust1" })
        .ContentHtmlAttributes(new { data_navigate = "navigate_content", @class = "trigger", title = "content_title" })
        .LinkHtmlAttributes(new { data_navigate = "navigate_link", @class = "trigger", title = "content_link" });
    })
)
  1. Run the page and inspect the TreeView item.

Expected/desired behavior

The attributes are serialized and rendered.

Environment

  • **Kendo UI version: 2021.2.616
  • **jQuery version: 1.12.4
  • **Browser: [all]

kendo-bot avatar Aug 20 '21 07:08 kendo-bot

Another problematic scenario with HtmlAttributes - https://github.com/telerik/kendo-ui-core/issues/5731

Dimitar-Goshev avatar Aug 20 '21 08:08 Dimitar-Goshev

At this point adding content and link attributes cannot be achieved for the wrappers, as the core component does not expose such API.

Furthermore, adding attributes to the item (.HtmlAttributes) works for all attributes except classes (again limitation in the core component):

  • https://github.com/telerik/kendo/blob/master/src/kendo.treeview.js#L514

gyankov avatar Oct 12 '22 12:10 gyankov

Increased priority due to a report in TicketID: 1639949

mihaela-lukanova avatar Feb 16 '24 15:02 mihaela-lukanova