I have the same problem as detailed in the post "Resize jqGrid based on number of rows?" here on *...
我有同样的问题,详见帖子“根据行数调整jqGrid?”这里是* ...
Now 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%"...
现在一些建议(看起来完全合乎逻辑)不起作用,因为当我尝试使用var height = $(“#TableId”)来获取网格的高度时.height();它返回设置网格时设置的内容,即“100%”...
So how do I get the height in pixels?
那我怎么得到像素的高度?
Thanks
3 个解决方案
#1
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.
你之前的实验中有些不对劲。如果你在jqGrid定义中使用高度:'100%'或高度:'auto',你可以从演示中看到jQuery.height方法以像素为单位获得网格的高度。
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()
.
顺便说一下,如果你想知道完整的网格高度,包括捕获,标题,寻呼机等,你应该得到$(“#gbox_TableId”)。height()而不是$(“#TableId”)。height( )。
#2
1
Jqgrid creates a lot of extra markup wrapping your initial table. So, to change its height, you can do this:
Jqgrid创建了大量包含初始表的额外标记。所以,要改变它的高度,你可以这样做:
$("#TableId").closest(".ui-jqgrid-bdiv").height(200);
Hope this helps. Cheers
希望这可以帮助。干杯
#3
1
Simple use
$('.ui-jqgrid-bdiv').css('height', '100%');
#1
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.
你之前的实验中有些不对劲。如果你在jqGrid定义中使用高度:'100%'或高度:'auto',你可以从演示中看到jQuery.height方法以像素为单位获得网格的高度。
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()
.
顺便说一下,如果你想知道完整的网格高度,包括捕获,标题,寻呼机等,你应该得到$(“#gbox_TableId”)。height()而不是$(“#TableId”)。height( )。
#2
1
Jqgrid creates a lot of extra markup wrapping your initial table. So, to change its height, you can do this:
Jqgrid创建了大量包含初始表的额外标记。所以,要改变它的高度,你可以这样做:
$("#TableId").closest(".ui-jqgrid-bdiv").height(200);
Hope this helps. Cheers
希望这可以帮助。干杯
#3
1
Simple use
$('.ui-jqgrid-bdiv').css('height', '100%');