Dieter
Dieter

Reputation: 331

Resize jqGrid based on number of rows? - Grid height?

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?

Upvotes: 3

Views: 4098

Answers (3)

Maheshbabu Jammula
Maheshbabu Jammula

Reputation: 467

Simple use
$('.ui-jqgrid-bdiv').css('height', '100%');

Upvotes: 1

Edgar Villegas Alvarado
Edgar Villegas Alvarado

Reputation: 18344

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

Upvotes: 1

Oleg
Oleg

Reputation: 221997

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().

Upvotes: 4

Related Questions