3

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.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
meff
  • 31
  • 1
  • 4

2 Answers2

0

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.

Adrian J. Moreno
  • 14,350
  • 1
  • 37
  • 44
0

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,

JQGrid Programatically Select Grid Row

it has examples and code.

Community
  • 1
  • 1
D-S
  • 107
  • 2
  • 10