GWT DataGrid: how to scroll to the top

372 views
Skip to first unread message

Cedric

unread,
Oct 6, 2011, 3:59:16 PM10/6/11
to Google Web Toolkit
When changing the content of my DataGrid I would like the grid to
scroll back to the top but it does not happen automatically.

I have two grids side by side (see http://code.google.com/p/bug4j/ )
and when the selection changes on the left, the content changes on the
right.

I found a workaround but it isn't pretty:
final DataGrid<BugHit> ret = new DataGrid<BugHit>(PAGE_SIZE){
@Override
public void setRowData(int start, List<? extends BugHit>
values) {
final HeaderPanel headerPanel = (HeaderPanel)
getWidget();
final ScrollPanel scrollPanel = (ScrollPanel)
headerPanel.getContentWidget();
scrollPanel.scrollToTop();
super.setRowData(start, values);
}
};

1) Did I miss something?
2) Should I file a bug?
3) What is the bug? a) the DataGrid should expose the ScrollPanel or
b) DataGrid it should scroll automatically to the top?

Jeff Larsen

unread,
Oct 7, 2011, 9:24:18 AM10/7/11
to google-we...@googlegroups.com
I'd go with 3a. Your usecase may not be everyone else's usecase (although it makes sense). 


Cedric

unread,
Oct 7, 2011, 12:10:14 PM10/7/11
to Google Web Toolkit

jason98

unread,
Oct 9, 2011, 6:38:54 PM10/9/11
to Google Web Toolkit
Added my use case (lazy row rendering) to the bug page. It requires
scrollPanel access too.

On Oct 7, 9:10 am, Cedric <cdan...@gmail.com> wrote:
> I have filedhttp://code.google.com/p/google-web-toolkit/issues/detail?id=6865.
Reply all
Reply to author
Forward
0 new messages