How to get a page number by row id in jqGrid
After loading a JSON (using loadonce: true) I get a paged grid.
Now, on gridComplete callback I'd like to jump to page that contains a row (specified by ID).
I'm frustrated that there is no solution as far. I've triead a setSelection method, but it selects the row only if it's on current page.
Well, you only have one page of data returned to the grid at a time. Part of that JSON packet should be the total number of pages that exist in the record set given your "per page" setting.
I'd suspect you'd have to craft a stored procedure that generates your record set, determines the pages of data, then filters down to the page that contains the requested record ID and return that page, rather than the first page in the set. This seems to be more trouble (and more overhead) than if you just return a single record based on your record ID.
I believe, if you are doing a loadonce:true, then you are returning all the data from the server, You could iterate through all the records on the client side once the data is loaded to find the correct rowID, and calculate which page its on, then set that row and/or page once found.
Check out this post,
it has examples and code.