问题
I have my PHP application as the "authority" for row limiting, sorting, etc., meaning it outputs this information with the AJAX response and I update jqGrid's settings to match.
The problem:
I first load the grid omitting limit, page, etc. in order to use the defaults defined in PHP. The AJAX request fires and I get my response. It's returning 27 rows worth of data and a limit for rowNum of "50".
Within loadComplete I use grid.setGridParam to update the grid settings and use grid.sortGrid (w/ reload=false) to update some of the visuals and everything works... except it's only displaying 20 of the 27 rows returned.
I've used console logs to verify that 27 rows are returned from the call and an element viewer to verify that only 20 table rows were added to the DOM. This is evidence that it's not just a display issue (some height setting cutting the last 7 off) but it looks like jqGrid's logic is cutting them off.
回答1:
Solved it before even finishing my question, but will share in case anyone else runs into this.
Though the docs claim "loadComplete" fires "immediately after every server request", it looks like at least some processing/rendering is performed before it fires. I moved the setGridParam and sortGrid code into "beforeProcessing" instead and it seems to have solved the problem.
来源:https://stackoverflow.com/questions/30541610/jqgrid-dynamic-rownum-not-displaying-returned-rows