Search code examples
gwtsmartgwt

Smart-Gwt window not redrawing scrollbars when child widget changes?


I am using a smartgwt window to show some dynamic content. The content is a bunch of collapsible panels that the user can expand as desired. However, whenever the content changes expands, the smartgwt window stays the same. I am expecting that it would draw scrollbars whenever the content changes.

The scrollbars do appear, however, if the user manually resizes the window (that is even by doing a dummy resize, or resizing by 1px).

This question is very similar to this one: How do I make a gwt-ext window not resize when its content resizes?

However, the solution suggests the use of a setAutoScroll(true) which is no longer a method of window.

Any ideas of a similar method, or a simple workaround?

Cheers


Solution

  • If you were using SmartGWT components for the content, the SmartGWT Window would automatically respond and show scrollbars.

    Since you're using something else, SmartGWT does not receive a notification that the components have changed size, however, you can place all the components into a SmartGWT Canvas container and call adjustForContent() whenever the size of the components changes.

    http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/Canvas.html#adjustForContent%28boolean%29

    Note that this is one of many reasons why we recommend avoiding mixing different component sets (eg GWT built-in widgets and SmartGWT widgets) - other problems include maintaining the tab order, pixel-perfect layout, and modality coordination. Explained in more detail here:

    http://forums.smartclient.com/showthread.php?t=8159#aMix