With the struts plugin I'm using I had to give up on that approach and only use the jqgrid variables in click events because it uses the document.ready to load the grid. I ended up doing a bit of server side work to get the pages numbers for scripts. It's an extra server side count but it's not the worst case.