dataBound

Fires when the ContextMenu is bound to the set DataSource.

Event Data

e.item HTMLElement

The loaded item (at initial bound this will be the Menu root element).

e.dataItem Object

The dataItem that is being loaded or bound (at initial bound this should be undefined).

Example

<div id="target">Target</div>
<ul id="context-menu"></ul>
<script>
    var dataSource = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: "https://demos.telerik.com/kendo-ui/service/Employees",
                dataType: "jsonp"
            }
        },
        schema: {
            model: {
                id: "EmployeeId",
                hasChildren: "HasEmployees"
            }
        }
    });

     $("#context-menu").kendoContextMenu({
        target: "#target",
        dataTextField: "FullName",
        dataSource: dataSource,
        dataBound: function(){
/* The result can be observed in the DevTools(F12) console of the browser. */
            console.log("dataBound");
        }
    })
</script>

To set after initialization

<div id="target">Target</div>
<ul id="context-menu"></ul>
<script>
    var dataSource = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: "https://demos.telerik.com/kendo-ui/service/Employees",
                dataType: "jsonp"
            }
        },
        schema: {
            model: {
                id: "EmployeeId",
                hasChildren: "HasEmployees"
            }
        }
    });

    var contextMenu = $("#context-menu").kendoContextMenu({
        target: "#target",
        dataTextField: "FullName",
        dataSource: dataSource
    }).data("kendoContextMenu");

    contextMenu.bind("dataBound", function() {
/* The result can be observed in the DevTools(F12) console of the browser. */
        console.log("dataBound");
    });
</script>
In this article
Not finding the help you need? Improve this article