This is a migrated thread and some comments may be shown as answers.

Can't get Kendo Menu reference

3 Answers 170 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Wonderer
Top achievements
Rank 1
Wonderer asked on 02 Oct 2012, 03:36 PM
Hi, I'm wondering why I can't get the reference of my kendo menu. The code is wrapped inside a document ready of jquery.

var menu = $("#menu").data("kendoMenu");
 
        menu.bind("select"function (e) {
            var menuItemHeader = $('#menu li').first();
            var menuItemHeaderValue = $(menuItemHeader).find('.k-link').text();
 
            alert(menuItemHeaderValue);
        });

Firebug is saying that my "menu" is undefined but when I inspect the $('#menu'), I'm seeing some kendo events and properties.
Did I miss something?

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Oct 2012, 03:48 PM
Hello Paolo,

Please make sure that you have no JS errors, the above code is placed after the Menu initialization script, and there is only one jQuery instance on the page.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Wonderer
Top achievements
Rank 1
answered on 03 Oct 2012, 12:41 AM
@Dimo

Hi Sir,

I'm not seeing any errors on firebug other than the the "menu" is undefined. I'm using razor to initialize the Kendo menu, is it alright? or should I use the js way of initializing the kendo menu in order to get the reference of it?
0
Dimo
Telerik team
answered on 03 Oct 2012, 06:54 AM
Hello Paolo,

In case you are using the MVC wrapper of the Kendo UI Menu, your Javascript code should come after the Menu.

If you need further assistance, please open a support ticket and send a runnable demo, which reproduces the unexpected behavior.

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Menu
Asked by
Wonderer
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Wonderer
Top achievements
Rank 1
Share this question
or