Monday, March 9, 2020

Re: GWT DataGrid getRowElement throwing IndexOutOfBoundsException after manually setting the page

Hi Thomas,

Thanks very much for your response.  I had considered that, but had been convinced by the various logging messages I had (including the grid pager reporting the current rows) that the request to fetch the requisite rows had happened.

However, on further review (and adding the most important but previously overlooked log statement to the data row request RESPONSE processing :-/ ) it was clear that you are indeed correct and the rows had not yet been retrieved.

Thanks for again for your response and nudging me back down that path.

- Linus 

On Thursday, March 5, 2020 at 2:07:48 AM UTC-8, Thomas Broyer wrote:
It's probably a timing issue: all (most) changes to an AbstractCellTable are actually deferred to the end of the event loop (through Scheduler.scheduleFinally), so you have to defer the second part of your code (the one that calls getVisibleRange and getRowElement).
Did you try to step-by-step debug your code? (through the browser's debugger, or simply GWT.log() statements)

On Wednesday, March 4, 2020 at 6:29:40 PM UTC+1, Linus Kamb wrote:
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