:: Forum >>

get grid's width?

I set a grid width 90%:

grid.setStyle("width",90%);

Now, I like to get the grid's width in px. I tried:

grid.getStyle("width");

It just return "90%". How can I get the grid's width in px?

Thanks,
mrhsh
Thursday, May 1, 2008
Use native DOM methods/properties -

var width = grid.element().offsetWidth;
Alex (ActiveWidgets)
Thursday, May 1, 2008
I just tried, but it didn't work.

var grid=new AW.UI.Grid;
var width = grid.element().offsetWidth;
alert(width);

Any idea?

Thanks,
mrhsh
Thursday, May 1, 2008
var grid=new AW.UI.Grid;
document.write(grid);
var width = grid.element().offsetWidth;
alert(width);
Thursday, May 1, 2008
I got it. "grid.element().offsetWidth" must be AFTER "document.write(grid)". Unfortunately, I need to get the grid's width to set one column's width in the same grid, and it must be done BEFORE "document.write(grid)" Actually, this grid is nested in a tab page. Is there any other way to get the grid's width?

Right now, I have to work around by

var width=scree.width*0.9

However, this is not a nice way. the "width" does not depend the grid's width.

Thanks,
mrhsh
Thursday, May 1, 2008

This topic is archived.


Back to support forum

Forum search