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

Getting rows count from grid

1 Answer 1808 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cat-the-developer
Top achievements
Rank 1
Cat-the-developer asked on 12 Jul 2016, 11:15 AM

Greetings!

I am trying to get rows count from Grid datasource via using standard API. Here is the code

 

 var grid = $("#contractProductsGrid").data("kendoGrid");

grid.dataSource.read();

console.log(grid);

console.log(grid.dataSource.total())

 

total() - gives me 0 but if i check grid object in console log I can see _data array with length 1 (for grid with 1 row)

 

1 Answer, 1 is accepted

Sort by
0
Orlin
Telerik team
answered on 14 Jul 2016, 08:34 AM
Hello,

I tried to reproduce the described issue in a very basic scenario, but to no avail. I have set up a simple Dojo example to demonstrate how to create a simple DataSource object and use it with a Grid component. You can find it here: http://dojo.telerik.com/aNAvI/2.

Note that the total method call on the DataSource returns the correct value after Kendo Grid has completed data binding.

Let me know if you need further assistance with this.

Regards,
Orlin
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Cat-the-developer
Top achievements
Rank 1
Answers by
Orlin
Telerik team
Share this question
or