Click here to Skip to main content
15,905,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 10-Apr-12 20:59pm
v2

1 solution

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:

Java
{
	...
	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));
}


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


whereas heightOfTable is defined by the display resolution....
 
Share this answer
 
Comments
Vincent Ghomus 11-Apr-12 3:34am    
Sorry, I missed to specify I'm using struts-jquery-grid. So from action class I'm returning a json object to jsp page. There for setting fluid width I'm adding jquery.jqGrid.fluid.js file in project and then using $('#sample_grid').fluidGrid({base:'#grid_wrapper', offset: 0});
in my jsp file. So can I set fluid height in a similar manner using any jQuery ?
TorstenH. 11-Apr-12 3:54am    
I expect you to be a developer and to be able to adapt the provided functionality into whatever you are currently working in.
It should be no problem to read the display ratio and to resize the GUI relative to these values.
Vincent Ghomus 11-Apr-12 5:28am    
okay.. Thank You :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900