jqgrid header
may contain extra toolbar defined using
toolbar: [true, "top"],
contains navigation toolbar defined using
$grid.jqGrid('navButtonAdd', '#grid_toppager', {...
and contains search toolbar.
To resize grid to end of screen I’m looking for a way to calculate this header height
in window resize.
I tried code below but this sets grid height too big.
How to calculate grid header height ?
$(window).resize(function () {
var extraToolbarHeight = $('#t_' + $.jgrid.jqID($grid[0].id)).outerHeight(true),
caption_height=$("div#gview_"+$grid[0].id+" > div.ui-jqgrid-hdiv").outerHeight(true);
$('#grid1container').height($(window).height() - 18);
$grid.jqGrid('setGridHeight', $('#grid1container').height()-caption_height
-extraToolbarHeight );
});
<div id="grid1container" style="width: 100%; height: 100%">
<table id="grid">
</table>
</div>
Here is a function I wrote to resize my jqGrids to fit their container element. See if it fits your needs.