3.2.0

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
May 1,
Use native DOM methods/properties -

var width = grid.element().offsetWidth;
Alex (ActiveWidgets)
May 1,
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
May 1,
var grid=new AW.UI.Grid;
document.write(grid);
var width = grid.element().offsetWidth;
alert(width);
May 1,
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
May 1,

This topic is archived.

See also:


Back to support forum