Yawn
Yawn

Reputation: 519

jqGrid get all ids

I've noticed a small bug with jqgrid that if you have virtual scrolling set to 1 and try and try to select all rows it doesn't actually select them all meaning when you call

$("#file-grid").jqGrid('getGridParam','selarrrow'); 

to get all selected row data it doesn't actually get all the data. I was wondering if there was a method to get all row ids, selected or not using jqgrid.

Upvotes: 7

Views: 31595

Answers (3)

sahar
sahar

Reputation: 115

You can use this code:

 var grid = jQuery("#mylist");
 var ids = grid.jqGrid('getDataIDs');

 for (var i = 0; i < ids.length; i++) {
    var rowId = ids[i];
 }

Upvotes: 0

Donald T
Donald T

Reputation: 10667

Use the following if you're not using pagination:

var allRowsOnCurrentPage = $('#file-grid').jqGrid('getDataIDs');

Upvotes: 11

Sean
Sean

Reputation: 1064

could you try getRowData() with no parameters - it should return all of the rows in the grid:

var allRowsInGrid = $('#file-grid').jqGrid('getRowData');

I got this from the jqGrid wiki:

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods

Upvotes: 4

Related Questions