Wednesday, March 4, 2020

GWT DataGrid getRowElement throwing IndexOutOfBoundsException after manually setting the page

I have a DataGrid, and I would like to display a row that is not in the currently visible row set, however, I get an indexOutOfBound Exception when I call getRowElement().

In my code, I determine in which page of results the desired row exists and I set the appropriate page with


I then try to get the RowElement using the following, where showRow is the actual row index in the dataset.

  Range range = dataGrid.getVisibleRange();
int start = range.getStart();
int rowIdx = showRow - start;
TableRowElement row = dataGrid.getRowElement(rowIdx);

But that throws the indexOutOfBounds Exception.

I have also tried using the actual row index with the same result.

The page is properly set and displays the page of results that includes the desired row, but I am unable to get the RowElement in order to scroll the display.

Note that if the user has already manually paged to the page that includes the desired row, and as such the setPage() operation is not performed, I can successfully get the RowElement with this  method and scroll the view.

Runtime logging would indicate that the appropriate rows have been fetched.

Any insights into what I am missing or doing wrong would be most appreciated.

- Linus

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

No comments:

Post a Comment