开发者

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

开发者 https://www.devze.com 2023-03-03 01:22 出处:网络
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 gri

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 ge开发者_StackOverflowt the height in pixels?


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


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


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

精彩评论

暂无评论...
验证码 换一张
取 消