Completed
Last Updated: 06 Dec 2019 09:46 by ADMIN
ChrisS
Created on: 20 May 2014 11:34
Category: Menu
Type: Feature Request
2
Adding the id to a menu item that is created programatically
According to the documentation at:

http://docs.kendoui.com/kendo-ui/api/web/menu#configuration-dataSource 

you can add the following information to a dataSource:

text
cssClass
url
encoded
content
imageUrl
spriteCssClass

However you cannot add an id to the menu item you are creating.  This makes it very difficult to remove items by using:

menu.remove("#Item1");

The only way round this is to assign a unique class to each menu item and then remove them using:

menu.remove(".news");

If an id can be added that would be great.  You have an example here:

http://docs.kendoui.com/kendo-ui/api/web/menu#methods-remove

Which is what we would like to do except the items will be created via a program and not static HTML.
2 comments
ADMIN
Ivan Danchev
Posted on: 06 Dec 2019 09:46

Hello,

It is possible to add an id to an item when the Menu is using a dataSource, through the attr property:

attr: {
  id: "item1"
}

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.
Andrea
Posted on: 07 Jan 2015 18:54
It would also be nice if you could programatically set the title of a menu item so that you can have a tooltip for the menu item that's different than the standard text.