For a long time I am looking for an answer to how to make the fluid height in jqGrid, but I still have not found it.
So, I need fluid height.
I know how to make fluid width:
jQuery(window).resize(function(){
gridId = "grid";
gridParentWidth = $('#gbox_' + gridId).parent().width();
$('#' + gridId).jqGrid('setGridWidth',gridParentWidth);
})
I tried with
gridParentHeight = $('#gbox_' + gridId).parent().height();
$('#' + gridId).jqGrid('setGridHeight',gridParentHeight);
but that is not working.
Is there a solution?
I found a solution for my problem. Here is the code (works in Firefox):
winHeight = window.innerHeight;
wHeight = winHeight - 90;
$("#grid").jqGrid('setGridHeight',wHeight);
jQuery(window).resize(function(){
gridId = "grid";
gridWidth = $('#gbox_' + gridId).parent().width();
$('#' + gridId).jqGrid('setGridWidth',gridWidth);
if(wHeight < 110){ //Height of five rows in grid is 110 pixels.
wHeight = 110;
$('#'+ gridId).jqGrid('setGridHeight',wHeight);
}
else {
$('#'+ gridId).jqGrid('setGridHeight',wHeight);
}