How to get row count for jqGrid?

developer picture developer · Apr 6, 2010 · Viewed 66k times · Source

I would like to know how to get row count for jqGrid. I'm using rowNum: -1 so it displays all the rows. I tried using:

parseInt($("#grid").getGridParam("records"), 10)

But it always returns 0.

Thanks for the help.

Answer

Justin Ethier picture Justin Ethier · Apr 6, 2010

Try:

$("#grid").getGridParam("reccount")

from the jqGrid documentation:

reccount (integer):

Readonly property. Returns the exact number of rows in the grid


Note also that, as Mike commented, you need to use the getGridParam method with the records option to retrieve a count of all the rows if you are using pagination.