I have jqGrid which size is dynamically calculated on window resize as follows:
$(window).bind('resize', resizeTable);
function resizeTable(){
$("#jqGrid")
.setGridWidth($("#tableHolder").innerWidth()),
.setGridHeight($("#tableHolder").innerHeight());
};
Having constant rowNum, scroll bar appears on grid if y-size isn't enough to hold given number of rows.
I want rowNum to be calculated automatically to display only rows which fit in a visible area of the grid and make others move to next pages and have no scroll bar. Is that possible?
You don't included in your question how you calculate the size based on on window resize and which more important which options of jqGrid you set and when you set (in which callback/event).
In general one can either set height
or rowNum
. I personally prefer to specify rowNum
(which value could be calculated based on the window resize) and to use height: "auto"
, which is default value of height
in free jqGrid. As the result, the grid will never have vertical scroll bars.
Additionally I prefer to use top pager (toppager: true
) instead of the botom pager (pager
option) if the height of rows of the grid could be variable.