:: Forum >>

Dynamically scaling grid size

Hi!

I use the Activewidgets grid in an application that is dynamically scaled so that the layout depends on the size of the browser’s client area. The problem is that the dimensions of the grid are reset to their initial values (100%) after sorting or resizing a column and also after it finishes loading data. So I can’t use the window.onload or window.onresize events that I use to scale other application elements. To scale the grid’s height I currently let the browser call a function every 1000 msec. Something like:

obj.setId("grid");

var browseHeight;

function scaleGrid(){
browseHeight=document.body.clientHeight;
document.getElementById("grid").style.height=browseHeight+'px';
}

function scaleApp() {
scaleGrid();
// Scale other elements
//..
}

window.setTimeout("scaleGrid();", 1000);

window.onload=scaleApp;
window.onresize=scaleApp;


This does the trick, but I suspect there are better ways. For example, by programming one of the grid’s event handlers (onRefresh?). Can anyone tell me how this should be done?

Thanks in advance
Bart H.
Friday, May 13, 2005
Sorry! The above code must actually be something like:

obj.setId("grid");

var browseHeight;

function scaleGrid(){
browseHeight=document.body.clientHeight;
document.getElementById("grid").style.height=browseHeight+'px';
window.setTimeout("scaleGrid();", 1000);
}
scaleGrid();

function scaleApp() {
// Scale other elements
//..
}

window.onload=scaleApp;
window.onresize=scaleApp;


Question remains the same..
Bart H.
Friday, May 13, 2005
If your users are all on IE, you can use the following in your CSS:

height: expression(((document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)-(ignoreMe=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)-200)+'px');

where "200" is the depth of whatever you have at the top of the page.

This works OK for me. Maybe this will give you an idea as to how you might solve your problem.
Roy Cosway
Wednesday, May 18, 2005
Thanks a lot, it's working on IE. But i also need something working on Mozilla... Do you know how to make it?
pierre
Wednesday, November 2, 2005
Does the grid take up the entire page or is it part of other stuff on the page?
Jim Hunter
Wednesday, November 2, 2005
I haven't got the above code from Roy working - where should this CSS go? I've tried to find where the height of the whole grid is set, but can't - can anyone help?!
Robin McKenzie
Monday, November 7, 2005

This topic is archived.


Back to support forum

Forum search