How to force a redraw/re-layout in Ext GWT (GXT)?

Cuga picture Cuga · Jan 24, 2011 · Viewed 17k times · Source

In GXT, I've got a control with an important panel added to the bottom component, basically like this:

public class SamplePanel extends ContentPanel {

ContentPanel panel = new ContentPanel();    

public SamplePanel() {
    setBottomComponent(panel);
}

public void setVisible(boolean isVisible) {
    panel.setVisible(isVisible);
}

The panel is being set as the "bottom component" because it needs to stay at the bottom of the widget and viewable at all times.

The problem is, while the visibility of the panel toggles correctly, the 'bottom component' area doesn't resize to become smaller and fit the new dimensions of the bottom area.

However, I've noticed that the bottom area does resize when I manually change the size of the widget with the mouse.

Is there any way to programatically force a redraw/repaint/re-layout... anything to have the bottom component change to reflect the new size of its contents?

I've tried all of these and they don't work:

public void setVisibility(boolean isVisible) {
        panel.setVisible(isVisible);
        doLayout(true);
        recalculate();
        repaint();
    }

Thanks

Answer

Jordi P.S. picture Jordi P.S. · Apr 5, 2012

In the last gxt you can do.

this.layout(true);

Otherwise you can fire an Events.Resize event.