Adding root item

3 posts, 1 answers
  1. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 16 May 2012 Link to this post

    I know how to add an menu item to an existing item but I would like to know how to add an item to the menu root.

    Here's the code I have so far:

    var MainMenu = $("#MainMenu").kendoMenu({
        animation: {
            open: { effects: "fadeIn" },
            close: { effects: "fadeIn" }
        }
    });
     
    MainMenu.append({ text: "New Root Item" }, MainMenu);

  2. Answer
    Kamen Bundev
    Admin
    Kamen Bundev avatar
    1532 posts

    Posted 17 May 2012 Link to this post

    Hi Simon,

    You should simply omit the reference item, like this:
    MainMenu.append({ text: "New Root Item" });

    Also, you probably just missed it in the post, but your menu variable should be populated from the kendoMenu data attribute, like this:
    var MainMenu = $("#MainMenu").kendoMenu().data("kendoMenu");

    All the best,
    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!
  3. Kendo UI is VS 2017 Ready
  4. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 17 May 2012 Link to this post

    Hello Kamen,

    You are right, I didn't know I was suppose to populate de menu from the Data attribute.  I'm still a bit confuse between the value I was working with and the value from the data store (I admit that I am still a newbie to javascript and kendoUI).

    Thanks for your help!

    Simon
Back to Top