Have ScrollPanel use 100% height?

414 views
Skip to first unread message

mark

unread,
Aug 19, 2012, 7:55:43 PM8/19/12
to google-we...@googlegroups.com
Hi,

I want to make a VerticalPanel inside a ScrollPanel which takes up 100% width and height. I can't get this to work:

  VerticalPanel vp = new VerticalPanel();
  vp.setHeight("100%");
  vp.add(new Label("pleeeeease...");
 
  ScrollPanel sp = new ScrollPanel();
  sp.setHeight("100%");
  sp.add(vp);

  RootPanel.get().add(sp);

What am I missing? The width seems to be 100%, but the height keeps wrapping.

Thanks

Jens

unread,
Aug 19, 2012, 8:22:41 PM8/19/12
to google-we...@googlegroups.com
ScrollPanel uses two DIV elements. When you set the ScrollPanel's height to 100% only the container DIV will have the height set. The second inner DIV does not have a height and thus your ScrollPanel's content can't be 100% as its direct parent does not have a height. 

The question is: Why do you want a 100% height content inside a ScrollPanel? Doesn't make sense to me. Simply remove the ScrollPanel. 
If there is no other way around you have to give the second DIV inside the ScrollPanel a height of 100% manually.

-- J.

mark

unread,
Aug 19, 2012, 8:35:18 PM8/19/12
to google-we...@googlegroups.com
Hi Jens,

Ok I thought we had to wrap our contents in a ScrollPanel if we wanted scroll support,

Thanks
Reply all
Reply to author
Forward
0 new messages