调整jqgrid的高度 [英] adjust jqgrid height

查看:156
本文介绍了调整jqgrid的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着屏幕分辨率的变化,我需要动态调整jqgrid的高度以适合浏览器窗口.我需要计算页眉和页脚以及表格(可选).然后在剩余的空间中放置网格.

I need to adjust my jqgrid height dynamically to fit in the browser window as screen resolution changes.I need to calculate the header and footer ,and form(optional)..Then grid should be fitted in the remaining space.

推荐答案

您可以通过基于window.innerHeight属性的CSS计算高度来设置.ui-jqgrid-bdiv元素的高度.

You could set the height of the .ui-jqgrid-bdiv element via css calculating the height based on the window.innerHeight property.

就像这里,我将网格高度设置为可用窗口空间的70%:

Like here I will set the grid height to be 70% of the available window space:

$("#gview_mygrid > .ui-jqgrid-bdiv").css('height', window.innerHeight * .7);

您需要在每次更改分辨率时重新计算一次,但这应该很简单.

You would need to recalculate this on each resolution change but that should be pretty straight forward.

这篇关于调整jqgrid的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆