Fix scrolling when NavigationTable is not in ScrollPanel

When NavigationTable is rooted in the browser window (and not within
a ScrollPanel) it trusted the GWT native scrollIntoView() method
to make the requested row visible within the viewable region. This
does not work, possibly due to GWT bug 7762 [1].

Mozilla documentation [2] indicates scrollIntoView() is available
in most browsers including Chrome 1.0, Firefox 1.0, IE6, Opera 10
and Safari 4. When there is no ScrollPanel to rely on use the DOM
method and hope for the best.

[1] https://code.google.com/p/google-web-toolkit/issues/detail?id=7762
[2] https://developer.mozilla.org/en-US/docs/Web/API/element.scrollIntoView
Change-Id: Ibb742677c300e70a29f0b250415f979810c8386f
This commit is contained in:
Shawn Pearce
2013-07-17 14:53:59 -07:00
parent ebc13dc438
commit d0f531ec0b

View File

@@ -231,10 +231,13 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
}
});
} else {
tr.scrollIntoView();
scrollIntoView0(tr);
}
}
private static final native void scrollIntoView0(Element e)
/*-{ if (e.scrollIntoView) e.scrollIntoView() }-*/;
protected void movePointerTo(final Object oldId) {
final int row = findRow(oldId);
if (0 <= row) {