[英]Display the count of total number of records in the grid
我正在嘗試顯示網格中的記錄總數。 我使用了下面的代碼,但它不起作用。
你能告訴我如何解決它。
這是我的代碼
var grid = $("#grid1").data("kendoGrid");
console.log("grid" + JSON.stringify(grid));
var dataSource = grid.dataSource;
alert("dataSource", dataSource);
var count = grid.dataSource.total();
alert("count", count);
//records on current view / page
var recordsOnCurrentView = dataSource.view().length;
alert("recordsOnCurrentView", recordsOnCurrentView);
//total records
var totalRecords = dataSource.total();
alert("totalRecords", totalRecords);
在網格的dataBound 事件中獲取數據源的長度。
$("#grid1").kendoGrid({
dataSource: ds1,
height: 180,
scrollable: {
virtual: true
},
columns: [{
field: "codeLong",
title: "codeLong"
},
{
field: "codeShort",
title: "codeShort"
},
{
field: "name",
title: "name"
}
],
dataBound: function(e){
alert("totalRecords "+e.sender.dataSource._data.length);
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.