append

Appends an item to a Menu in the specified referenceItem's sub menu.

Example

<ul id="menu"></ul>
<script>
    //initialize the menu widget
    $("#menu").kendoMenu()
    // get a reference to the menu widget
    var menu = $("#menu").data("kendoMenu");

    menu.append([
        {
            text: "Item 1",
            cssClass: "myClass",                         // Add custom CSS class to the item, optional, added 2012 Q3 SP1.
            url: "http://www.telerik.com"                // Link URL if navigation is needed, optional.
        },
        {
            text: "<b>Item 2</b>",
            encoded: false,                              // Allows use of HTML for item text
            content: "text"                              // content within an item
        },
        {
            text: "Item 3",
            items: [{text: "Sub Item 1"},{text: "Sub Item 2"}] //Sub items
        },
        {
            text: "Item 4",
            spriteCssClass: "imageClass3"                // Item image sprite CSS class, optional.
        }
    ]);
</script>

Parameters

item Object|Array

Item to be appended, specified as a JSON object. An array of objects can also be passed.

referenceItem String|jQuery (optional)

A reference item to append the new item in. If omitted, the new item will be appended to the as a root item.

Returns

kendo.ui.Menu Returns the Menu object to support chaining.

In this article
Not finding the help you need? Improve this article