user1534664
user1534664

Reputation: 3418

Add databound function after kendogrid has been initialized

Let's say I have initialized a kendogrid like this.

$('#' + grids[i].gridName).kendoGrid({
    columns: [{
        width: 50, "template": "<input type=\"checkbox\" />"
    },
    {
        field: "Name",
        title: "Name"
    }]
}).css('width', '100%');

How can I add a databound function to the already existing kendoGrid?

The following does not work.

$("#grid").data("kendoGrid").dataBound = function(){
     //some code
}

Upvotes: 3

Views: 2557

Answers (2)

Abbas Galiyakotwala
Abbas Galiyakotwala

Reputation: 3019

you may add databound function as below

$('#grid').data().kendoGrid.dataSource.bind('dataBound', function(e) { 
                 ...
});

Upvotes: 1

Vivek Parekh
Vivek Parekh

Reputation: 1085

Try this:

var grid = $("#grid").data("kendoGrid");
grid.bind("dataBound", function(e) {
    //your code here
});

Upvotes: 3

Related Questions