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
>
>   gridPager.setPage(showPage);
>
> 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.
>
> Thanks,
> - 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/5cf0da83-3043-4de7-b0a4-e44b9f3f5386%40googlegroups.com.

Reply via email to