ScrollTable scroll position

14 views
Skip to first unread message

ivovnenko

unread,
Oct 7, 2008, 8:04:33 AM10/7/08
to Google Web Toolkit
Hello everyone.
Is there any way to set scroll position in incubator's ScrollTable?
The use case:
I'm adding the element to the bottom(top) of the ScrollTable, and I
want it to be selected and visible - need to scroll to its position.
Thnx

Thomas Broyer

unread,
Oct 7, 2008, 10:32:40 AM10/7/08
to Google Web Toolkit
Did you gave a look at the ScrollPanel's javadoc (or your IDE's auto-
complete suggestions)?
- ensureVisible(UIObject)
- scrollToBottom / scrollToTop
- setScrollPosition(int)

ivovnenko

unread,
Oct 7, 2008, 1:11:43 PM10/7/08
to Google Web Toolkit
Well, haven't noticed such methods in ScrollTable...

Peter D.

unread,
Oct 7, 2008, 1:19:31 PM10/7/08
to Google Web Toolkit
They were added in GWT 1.5. So if you are using a 1.4 version or lower
they do not exist.

ivovnenko69

unread,
Oct 7, 2008, 1:20:51 PM10/7/08
to Google-We...@googlegroups.com
I'm using gwt1.5, and don't see such methods in ScrollTable.
--
Regards, Vanya Vovnenko

Peter D.

unread,
Oct 7, 2008, 1:35:43 PM10/7/08
to Google Web Toolkit
Well, don't know what to tell you. It's there, I use it myself. Here
is a link to the javadoc that says it exists.

http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/ScrollPanel.html#scrollToBottom()

ivovnenko69

unread,
Oct 7, 2008, 1:37:55 PM10/7/08
to Google-We...@googlegroups.com
Guys, I'm talking about ScrollTable, not ScrollPanel!
--
Regards, Vanya Vovnenko

Peter D.

unread,
Oct 7, 2008, 1:43:37 PM10/7/08
to Google Web Toolkit
Ah sorry about that, that's an incubator component. Seems really easy
to do with a verticalpanel and a scrollpanel...

On Oct 7, 1:37 pm, ivovnenko69 <ivovne...@gmail.com> wrote:
> Guys, I'm talking about ScrollTable, not ScrollPanel!
>
>
>
> On Tue, Oct 7, 2008 at 8:35 PM, Peter D. <pete...@gmail.com> wrote:
>
> > Well, don't know what to tell you. It's there, I use it myself. Here
> > is a link to the javadoc that says it exists.
>
> >http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/g...()

Thomas Broyer

unread,
Oct 8, 2008, 5:20:46 AM10/8/08
to Google Web Toolkit

On 7 oct, 19:37, ivovnenko69 <ivovne...@gmail.com> wrote:
> Guys, I'm talking about ScrollTable, not ScrollPanel!

Yep, sorry, just noticed...

Workaround attempt (untested):

// Adapt the fully-qualified class names if you're using the gen2
version
class ScrollTableUtils {
private static native Element getDataWrapper(ScrollTable table) /*-
{
return
table.@com.google.gwt.widgetideas.table.client.ScrollTable::dataWrapper;
}-*/;

private static native void scrollTables(ScrollTable table) {
table.@
com.google.gwt.widgetideas.table.client.ScrollTable::scrollTables(Z)
(false);
}

public static void scrollTo(ScrollTable table, int x, int y) {
Element dataWrapper = getDataWrapper(table);
dataWrapper.setScrollLeft(x);
dataWrapper.setScrollTop(y);
scrollTables(table);
}
}

Note that you could also derive ScrollTable to add the above methods
(scrollTables is protected, so you don't have to use JSNI to call it
if you follow this path)
Reply all
Reply to author
Forward
0 new messages