Resize jqGrid based on number of rows? - Grid height?
Asked Answered
S

3

3

I have the same problem as detailed in the post Resize jqGrid based on number of rows?

Some of the suggestions (which seem totally logical) do not work because when I try to get the height of the grid using var height = $("#TableId").height(); it returns what was set when setting up the grid, i.e. "100%"...

How do I get the height in pixels?

Slog answered 3/5, 2011 at 13:18 Comment(0)
D
4

It was something wrong in your previous experiments. How you can see from the demo the jQuery.height method get you the height of the grid in pixel if you use height:'100%' or height:'auto' in the jqGrid definition.

By the way if you want to know the full grid height including the capture, headers, pager and so on you should get hight of $("#gbox_TableId").height() instead of $("#TableId").height().

Downstage answered 3/5, 2011 at 14:5 Comment(0)
M
1

Jqgrid creates a lot of extra markup wrapping your initial table. So, to change its height, you can do this:

$("#TableId").closest(".ui-jqgrid-bdiv").height(200);

Hope this helps. Cheers

Microparasite answered 3/5, 2011 at 14:10 Comment(0)
P
1
Simple use
$('.ui-jqgrid-bdiv').css('height', '100%');
Proserpina answered 11/3, 2014 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.