Completed
Last Updated: 06 Dec 2019 08:05 by ADMIN
David Apelt
Created on: 21 Jan 2016 01:53
Category: Menu
Type: Feature Request
3
kendo ui menu id
In the kendo ui menu, we need the ability to associated a number (or primary key) with the menu so that when it is clicked we can then use this id and make an async js callback or the like.  At the moment the only thing we have available is the menu item text.  What happens if the menu has two menu items with the same text? ie File -> Properties and Folder -> Properties?
1 comment
ADMIN
Ivan Danchev
Posted on: 06 Dec 2019 08:05

Hello David,

You can set the id attribute in the li elements of the ul the Menu is initialized from:

<ul id="menu">
    <li id="Item1">Item 1
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
            <li>Sub Item 3</li>
        </ul>
    </li>
    <li>Item 2
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
            <li>Sub Item 3</li>
        </ul>
    </li>
</ul>
<script>
    $("#menu").kendoMenu();
    // get a reference to the menu widget
    var menu = $("#menu").data("kendoMenu");
    // open the sub menu of "Item1"
    menu.open("#Item1");
</script>

In scenarios where the Menu uses a dataSource, item ids can be set through the attr configuration option:

attr: {
  id: "item1"
}

This seems to cover the requested functionality, so we are closing this feature request.

Regards,
Ivan Danchev
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.