DockLayoutPanel inside ScrollPanel in GWT

2.1k Views Asked by At

I'm using GWT 2.4 and I'm having a problem with setting up scrollbars for my app working correctly. When I'm trying to zoom the page - no scrollbars are now displayed for the whole page.

Currently my app is composed of DockLayoutPanel and is displayed in the following way:

private DockLayoutPanel appContainer = new DockLayoutPanel(Style.Unit.PX);
(...)
appContainer.addNorth(bannerSimplePanel, 104);
appContainer.addWest(menuSimplePanel, 200);
appContainer.add(new ScrollPanel(contentSimplePanel));

RootLayoutPanel.get().add(appContainer);

I want to have scrollbar configured for whole page instead of only "main content" (contentSimplePanel) of the page. I've tried to add scrollbar to the last step:

RootLayoutPanel.get().add(new ScrollBar(appContainer));

but it didn't work. With ScrollBar added for whole appContainer only banner is displayed on my page and the rest is black.

Thanks for any help.

2

There are 2 best solutions below

5
On BEST ANSWER
Adding   DocklayoutPanel to a ScrollPanel won't work. The inner layout
panel's height and width will be zero. 

Use

dockLPanel.getWidgetContainerElement(flowPanel).getStyle().setOverflowY(Overflow.AUTO); 

Have a look on this

https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/BnboxugPuJQ

2
On

Its a simple fix I guess.

ScrollPanel sp = new ScrollPanel();
sp.setSize( "100%", "100%" );

private DockLayoutPanel appContainer = new DockLayoutPanel( Style.Unit.PX );
appContainer.addNorth( bannerSimplePanel, 104 );
appContainer.addWest( menuSimplePanel, 200 );
appContainer.add( contentSimplePanel );

sp.add( appContainer );
RootLayoutPanel.get().add( sp );