knockout-kendo.js网格数据绑定事件

时间:2014-07-17 13:56:33

标签: knockout.js kendo-ui knockout-mapping-plugin

我正在使用knockout-kendo.js将敲门绑定到Kendo网格。我正在尝试在网格更新后执行一些逻辑。我试图将数据绑定事件绑定到一个敲除函数,但无法使它工作。在这个Jsfiddle http://jsfiddle.net/QCnYx/中,从不调用gridDataBound函数。我错过了什么?

    <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());

1 个答案:

答案 0 :(得分:2)

它是dataBound(大写字母B)而不是databound

... databound:gridDataBound ...