I have a FlowPanel
, whose height is fixed (it is actually a percentage of its parent's height, which is fixed).
In this panel, I add several div
elements. Using CSS, I set its height as 100% of its parent.
What I want to do is set its width to be equal to its height using javascript.
The issue I have is that I don't know when to run this bit of javascript. I tried adding it to the onLoad()
method of my container, but the height is not known yet (getOffsetHeight()
returns 0).
I had a look at similar questions (like GWT - Retrieve size of a widget that is not displayed), but they were not exactly the same thing.
Defer the call to
getOffsetHeight()
until the end of the event loop: