Get Kendo grid Count
HTML
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css">
<div>
Grid Row count by "tbody" = <span id="GridRowCount"></span>
<br/>
Grid Row count by "view" = <span id="GridRowCount1"></span>
<br/>
Grid Row count by "tbody.find" = <span id="GridRowCount2"></span>
<br/>
Grid Row count by "dataSource.total" = <span id="GridRowCount3"></span>
<div id="Grid"></div>
</div>
JavaScript
$("#Grid").kendoGrid({
dataSource: {
data: [
{ "Dept": "ACT", "A": 10, "B": 2010, "Total": 7542 },
{ "Dept": "BCT", "A": 20, "B": 2010, "Total": 7542 },
{ "Dept": "CCT", "A": 20, "B": 2010, "Total": 7542 }
]
},
columns: [{
field: "Dept",
title: "Dapartment"
}, {
field: "A"
}, {
field: "B"
}, {
field: "Total"
}
]
});
$('#GridRowCount').text($("#Grid").data('kendoGrid').tbody[0].rows.length);
$('#GridRowCount1').text($("#Grid").data('kendoGrid').dataSource.view().length);
$('#GridRowCount2').text($("#Grid").data('kendoGrid').tbody.find('>tr').length);
$('#GridRowCount3').text($("#Grid").data('kendoGrid').dataSource.total());