3.2.0

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.
May 13,
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.
May 13,
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
May 18,
Thanks a lot, it's working on IE. But i also need something working on Mozilla... Do you know how to make it?
pierre
November 2,
Does the grid take up the entire page or is it part of other stuff on the page?
Jim Hunter
November 2,
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
November 7,

This topic is archived.

See also:


Back to support forum