Hi,
I am trying to specify a value with the menu item when I add it to the menu. When I inspect the menu.dataSource I can see the value I specified during initialization, however I don't see a way to associate the select event's e.item object to the menu.dataSource[N] object that the li was created from.
My goal is to store a value with each menu item that is NOT the text of the menu.
Any guidance is appreciated.
Thanks,
Elan
I am trying to specify a value with the menu item when I add it to the menu. When I inspect the menu.dataSource I can see the value I specified during initialization, however I don't see a way to associate the select event's e.item object to the menu.dataSource[N] object that the li was created from.
My goal is to store a value with each menu item that is NOT the text of the menu.
Any guidance is appreciated.
Thanks,
Elan
5 Answers, 1 is accepted
0
Accepted
Hello Elan,
Unfortunately currently there's no integrated way to access the dataSource item on select. This feature will come naturally with the introduction of a hierarchical structures support in Kendo DataSource and the possibility to bind Menu and PanelBar to it, since every item in the DataSource receives an unique ID which you can use to access it.
That said, it is possible to access the initial menu item in the dataSource option JSON with some javascript/jQuery magic. Check the following jsFiddle for how you can do it:
Regards,
Kamen Bundev
the Telerik team
Unfortunately currently there's no integrated way to access the dataSource item on select. This feature will come naturally with the introduction of a hierarchical structures support in Kendo DataSource and the possibility to bind Menu and PanelBar to it, since every item in the DataSource receives an unique ID which you can use to access it.
That said, it is possible to access the initial menu item in the dataSource option JSON with some javascript/jQuery magic. Check the following jsFiddle for how you can do it:
Regards,
Kamen Bundev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Rob
Top achievements
Rank 1
answered on 27 Mar 2012, 04:20 PM
I added the following code to open a dialog window for an about button on my main menu...
if(dataItem.value == "about")
{
var window = $("#aboutWindow").data("kendoWindow");
window.center();
window.open();
}
$("#aboutWindow").kendoWindow({
actions: ["Refresh", "Maximize", "Minimize", "Close"],
title: "About this app",
visible: false,
draggable: true,
height: "300px",
modal: true,
resizable: false,
width: "500px"
});
if(dataItem.value == "about")
{
var window = $("#aboutWindow").data("kendoWindow");
window.center();
window.open();
}
$("#aboutWindow").kendoWindow({
actions: ["Refresh", "Maximize", "Minimize", "Close"],
title: "About this app",
visible: false,
draggable: true,
height: "300px",
modal: true,
resizable: false,
width: "500px"
});
0

Victor Zhang
Top achievements
Rank 1
answered on 18 Oct 2012, 08:53 PM
I am using the following code to create menu dynamically.
$.getJSON("web api url",
function (data) {
menu.append(data);
}
$.getJSON("web api url",
function (data) {
menu.append(data);
}
Your technique does not work because menu.options.dataSource is null in select event. please help
0

Josh
Top achievements
Rank 1
answered on 26 Sep 2013, 08:43 PM
I'm still using this technique to get a selected items associated datasource data. Any update on when, or if, this will change?
0
Hello Joshua,
No, HierarchicalDataSource support is not yet available for Kendo Menu. Unfortunately I can't give you a time frame either, as there is not much interest shown about this in our Kendo UserVoice feedback page.
Regards,
Kamen Bundev
Telerik
No, HierarchicalDataSource support is not yet available for Kendo Menu. Unfortunately I can't give you a time frame either, as there is not much interest shown about this in our Kendo UserVoice feedback page.
Regards,
Kamen Bundev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!