PDA

View Full Version : GXT 3.0 - Scrollbars for containers (panels)



raivis
19 Dec 2011, 4:57 AM
Hello all!

I was wondering how can one get scrollbars for containers in GXT 3.0? E.g. I have VerticalLayoutContainer in a FramedPanel. Many Fields are added to VerticalLayoutContainer so that last ones are hidden because they all do not fit in. How can I add scroll bars for FramedPanel (or any other panel) ?

gishmo
19 Dec 2011, 5:22 AM
Just a thought ... have you tried to add a ScrollPanel? Don't know if this works, but I would give that a try.

raivis
19 Dec 2011, 9:57 PM
Thank you for answer, didn't know there is such a widget, but it's GWT widget though. In my personal experience most of the GWT widgets are not straight forward with GXT. And so is ScrollPanel. Maybe it's working if used correct way but simply adding it and setting size does not.

DavidHoffer
20 Dec 2011, 11:16 AM
I too can't get scroll bars to work with 3.0.0, if you figure it out let me know.

raivis
20 Dec 2011, 10:21 PM
I figured it out. The answer was in front of my eyes all the time:

http://staging.sencha.com:8080/examples-dev/#ExamplePlace:buttons

I (http://staging.sencha.com:8080/examples-dev/#ExamplePlace:buttons) used FlowLayoutContainer.


FlowLayoutContainer container = new FlowLayoutContainer();
// add your content
container.getScrollSupport().setScrollMode(ScrollMode.AUTO);

raivis
20 Dec 2011, 10:29 PM
All of these classes should do it as they all implement HasScrollSupport interface

CssFloatLayoutContainer
FlowLayoutContainer
HorizontalLayoutContainer
PortalLayoutContainer
VerticalLayoutContainer

DavidHoffer
21 Dec 2011, 11:13 AM
I had tried using VerticalLayoutContainer but with that class the call to getScrollSupport() returns null so that doesn't work and I wasn't sure how to create/set the ScrollSupport, however your example of using FlowLayoutContainer does work. I see that internally that container does this:


public ScrollSupport getScrollSupport() {
if (scrollSupport == null) {
scrollSupport = new DefaultScrollSupport(getContainerTarget());
}
return scrollSupport;
}

I'm not sure why VerticalLayoutContainer and perhaps the others don't. I'll see if I can use FlowLayoutContainer or add the above code when using VerticalLayoutContainer . Thanks!

pete_by
21 Dec 2011, 3:01 PM
I have the same problem with VerticalLayoutContainer. BorderLayoutContainer or ContentPanel work good in plan of scrolls. But I need V.L.C.

DavidHoffer
21 Dec 2011, 3:50 PM
I think you will have to extend VLC because getContainerTarget() is protected.

raivis
21 Dec 2011, 9:33 PM
Yeah, I noticed it as well. V.L.C and H.L.C returns null, so I asked sencha

http://www.sencha.com/forum/showthread.php?163721-ScrollSupport-for-Vertical-Horizontal-LayoutContainer-not-implemented

if that is lack of implementation and will be implemented later or if we have to make our own implementation.

pete_by
22 Dec 2011, 3:54 AM
I overrided getScrollSupport method extending VLC container but this did not help: method is never called for some reason. Maybe because VLC is not content constraining container?