:: Forum >>

API method for grid width/height

Is there an API method for determening the width/height of the grid object after it has been rendered or after the control size has been set?

objGrid = new AW.UI.Grid
objGrid.setId("myGrid")
w = body.clientWidth
h = body.clientHeight
objGrid.setControlSize(w, h)

...//get width/height ???

document.write(objGrid)


The reason I ask is because the grid may not always have a fixed width as defined by a style rule property. The grid's width may depend on the space available on a web page (which at the same time depends on the viewer's monitor settings).

So, after the control size has been set...

Is there a way to retrieve the width/height via API method calls?
Is there such a thing as objGrid.getControlSize()?
If not, how else could one go about this (without the use of css styles)?
Mario
Thursday, February 9, 2006
Mario,

obj.setSize(w, h);

is equivalent to

obj.setStyle("width", w + "px");
obj.setStyle("height", h + "px");

So in case you want to use % width or do some calculations - you may use setStyle methods directly. It also works in opposite direction,

var w = obj.getStyle("width");
var h = obj.getStyle("height");

Note, that getStyle methods return your previous setting and not actual object dimensions.
Alex (ActiveWidgets)
Thursday, February 9, 2006
Does it work only if you set the value in javascript ?
I use the CSS to set the width and height, and this function just returns undefined

<style>
#myGrid { width: 300px; height:150px; margin: 0px; padding: 0px}
....

myGrid.getStyle("width");
Lucho
Thursday, February 23, 2006
getStyle will return the value of 'inline' style settings and settings in a stylesheet would not be returned with this method.
Jim Hunter (www.FriendsOfAW.com)
Monday, February 27, 2006

This topic is archived.


Back to support forum

Forum search