View Full Version : Is this the correct way to do this?

7 Dec 2010, 12:47 PM

I display a Grid within a Window and I want the width of the window to adjust its width according to the total size of the columns.

This is what I've come up with (code adapted from the autoheight grid example). Is this the correct way to do this?

// w is the Window object
grid.addListener(Events.ViewReady, new Listener<ComponentEvent>()
public void handleEvent(final ComponentEvent ce)
* When the view is ready to display, adjust the window width.
final GridView v = grid.getView();
v.getScroller().setStyleAttribute("overflowX", "hidden");
w.setWidth(v.getHeader().getOffsetWidth() + w.getFrameWidth());

7 Dec 2010, 12:49 PM
It probably works, but i would calculate it based on the column width you set. This way you could set it to the correct size also from the beginning