I'm using the ASP.NET WebForms version of jqGrid, however I'm sure the same events should be available as the standard grid.
I have some pages with multiple grids on them, it could be just one, or could be several. I have a print button which will display 10,000 records (to display all the records on the grid), resize it to fit onto an A4 sheet, fire window.print()
and then go back to the original record count, and resize the grid back to 100%.
The missing part is to know when to fire window.print()
as I need to wait for all the grids to be loaded before doing so.
I've tried having a global var allGridsLoaded = false;
and then use the Load_Complete
event and beforePageChange
to set the var, but obviously with each grid resetting the var I'm not sure how to track them all?
In the Load_Complete
I'm thinking I could loop through each grid, but what's the cleanest way to tell if they've loaded?
I'm not sure that I full understand your requirements. Nevertheless it seems to me that you need
Load_Complete
for all gridsLoad_Complete
handle andwindow.print()
if the counter will have the value 0.So what you really need are two first things from the above list. Every grid will be build based on an empty
<table>
element. jqGrid adds"ui-jqgrid-btable"
class to all the tables. So you can useto get jQuery wrapper to all grids on the page.
$(".ui-jqgrid-btable").length
is the number of grids. To register common "global"Load_Complete
for all grids you can usejqGridLoadComplete
(orjqGridAfterLoadComplete
) event (see the documentation):See the answer for additional information.
I hope you will be able to implement all your requirements in the way.