This is a migrated thread and some comments may be shown as answers.

How to get the grid's rows count ? alert($('#Grid').data("kendoGrid").tbody.find('>tr.k-master-row').length); seems not right

3 Answers 344 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PEIYANG
Top achievements
Rank 1
PEIYANG asked on 09 Apr 2013, 06:54 PM
How to get the grid's rows count ?My grid has data,but the code shows 0 row..
alert($('#Grid').data("kendoGrid").tbody.find('>tr.k-master-row').length);

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 10 Apr 2013, 07:29 AM
Hi Peiyang,


The provided code seems correct for getting the count of the master rows in the Grid. 
E.g.
var grid = $("#grid").data("kendoGrid");
var masterRowsCount = grid.tbody.find('>tr.k-master-row').length;

This code should be executed after the Grid has bounded the data. You might receive 0 if you are calling it before that.

 

Greetings,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
hiroshi
Top achievements
Rank 1
answered on 12 May 2016, 05:20 AM
var grid = $("#grid").data("kendoGrid");
var masterRowsCount = grid.tbody.find('>tr.k-master-row').length;
0
Dimiter Madjarov
Telerik team
answered on 12 May 2016, 07:37 AM

Hello hiroshi,

Are you experiencing an issue with the provided sample code?

Regards,
Dimiter Madjarov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
PEIYANG
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
hiroshi
Top achievements
Rank 1
Share this question
or