How can one get the ID's of every row in a grid, even across pages?
getDataIDs
and getRowData
only gives the ID's of the current page.
Thanks!
It is possible only if you have local grid (datatype:'local'
or having loadonce:true
). In the case all data inclusive ids for all pages are already locally. In the case you can use _index
parameter, which will be used typically together with another more known parameter data
. With
var idToDataIndex = $("#list").jqGrid('getGridParam','_index');
you will get the _index
parameter. It is an object which has as the properties all ids of grid. So you can enumerate the ids with
var id;
for (id in idToDataIndex) {
if (idToDataIndex.hasOwnProperty(id)) {
// id is the rowid.
// to get the data you can use
// mydata[idToDataIndex[id]] where
// var mydata = $("#list").jqGrid('getGridParam','data');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With