Can't get Kendo Menu reference

4 posts, 0 answers
  1. Wonderer
    Wonderer avatar
    8 posts
    Member since:
    Oct 2011

    Posted 02 Oct 2012 Link to this post

    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?
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 02 Oct 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Wonderer
    Wonderer avatar
    8 posts
    Member since:
    Oct 2011

    Posted 02 Oct 2012 Link to this post

    @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?
  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 03 Oct 2012 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready