fge
7 Dec 2010, 12:47 PM
Hello,
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>()
{
@Override
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());
}
});
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>()
{
@Override
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());
}
});