jqGrid流体高度布局和基于屏幕分辨率的分页 [英] jqGrid Fluid height layout & Pagination based on screen resolution

查看:185
本文介绍了jqGrid流体高度布局和基于屏幕分辨率的分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果jqGrid总共包含40条记录,那么我将在一个页面中将其作为10条记录进行分页.因此,总共4页.它会在第一页中显示40中的1-10,然后在第二页中显示40中的11-20,依此类推,直到第4页.我的屏幕分辨率为1366 X768.因此,当我将同一个网格加载到更高分辨率的屏幕上时,我需要获得高度的流畅布局.否则,网格将占用与低分辨率屏幕相同的空间,并且网格和页脚之间将留有很多白色空间.同时,分页应动态更改,就像一页可能包含更多记录(例如20).然后,第一页应显示1-20(共40),第二页应显示21-40(共40).我在宽度上使用流体"布局.如何实现我在上面提到的Fluid的高度布局和分页?

问候,

Vincent

Hi,

If a jqGrid contains total 40 records, I''m giving pagination as 10 records in a page. So total 4 pages. It''ll show 1 - 10 of 40 in 1st page then 11 - 20 of 40 in second page and so on upto 4th page. My screen resolution is 1366 X 768. So when I load the same grid to some more high resolution screen, I need to get fluid layout in height. Otherwise the grid will occupy the same space as in low resolution screen and there will be much white space left between grid and footer. At the same time pagination should change dynamically like one page may contains more records (say 20). Then 1st page should show 1 - 20 of 40 and 2nd page 21 - 40 of 40. I''m using Fluid layout in width. How can I achieve Fluid layout in height and do pagination as i mentioned above?

Regards ,

Vincent

推荐答案

您需要定义GUI相对对象的高度(和宽度).
通过使用百分比值或-如果不可用-通过使用可以为您解决问题的计算方法来完成:

you need to define the height (and width) of your GUI relative.
That''s done by using percent values or - if not available - by using calculations which do the trick for you:

{
	...
	setColumns(1000);
}


private void setColumns(final int tableWidth) {// avoiding scroll bar - keep it at 99%
	oTableCol1.setWidth((int) (0.20 * tableWidth));
	oTableCol2.setWidth((int) (0.11 * tableWidth));
	oTableCol3.setWidth((int) (0.18 * tableWidth));
	oTableCol4.setWidth((int) (0.10 * tableWidth));
	oTableCol5.setWidth((int) (0.10 * tableWidth));
	oTableCol6.setWidth((int) (0.10 * tableWidth));
	oTableCol7.setWidth((int) (0.15 * tableWidth));
	oTableCol8.setWidth((int) (0.05 * tableWidth));
}



那是我的桌子之一.它根据给定的值计算表列的宽度.我给它一个1000的宽度-也可以从显示的分辨率中读取它,并且在每个系统上都不同.

表中的条目数是



That is one of my tables. It calculates according to the given value the width of the table columns. I give it a width of 1000 in this - which could also be read from the displayed resolution and be different on each system.

The number of entries in the table is

heightOfTable / heightOfOneEntry



而heightOfTable由显示分辨率定义....



whereas heightOfTable is defined by the display resolution....


这篇关于jqGrid流体高度布局和基于屏幕分辨率的分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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