Search code examples
knockout.jskendo-uiknockout-mapping-plugin

knockout-kendo.js grid databound event


I am using the knockout-kendo.js to bind knockout to a Kendo grid. I am trying to perform some logic after the grid is updated. I tried to bind the databound event to a knockout function, but can't get it to work. In this Jsfiddle http://jsfiddle.net/QCnYx/, the gridDataBound function is never called. What am I missing?

    <div data-bind="kendoGrid: { data: items, groupable: true, scrollable: true, sortable: true,     pageable: { pageSize: 10 },
databound:gridDataBound,
 }"></div>
<button data-bind="click: addItem">Add Item</button>


var ViewModel = function () {
this.items = ko.observableArray([{
    id: "1",
    name: "apple"
}, {
    id: "2",
    name: "orange"
}, {
    id: "3",
    name: "banana"
}]);

this.addItem = function () {
    var num = this.items().length + 1;
    this.items.push({
        id: num,
        name: "new" + num
    });
};
 this.gridDataBound = function () {
        alert("Grid Updated");

    }
};

ko.applyBindings(new ViewModel());

Solution

  • It's dataBound (capital B) not databound in:

    ... databound:gridDataBound ...