zbyszek26104
zbyszek26104

Reputation: 437

DockLayoutPanel inside ScrollPanel in GWT

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.

Upvotes: 3

Views: 2161

Answers (2)

Abhijith Nagaraja
Abhijith Nagaraja

Reputation: 3380

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 );

Upvotes: 0

Suresh Atta
Suresh Atta

Reputation: 121998

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

Upvotes: 6

Related Questions