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

Adding root item

2 Answers 74 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 16 May 2012, 06:22 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Kamen Bundev
Telerik team
answered on 17 May 2012, 07:54 AM
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!
0
Simon
Top achievements
Rank 1
answered on 17 May 2012, 11:52 AM
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
Tags
Menu
Asked by
Simon
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
Simon
Top achievements
Rank 1
Share this question
or