You can get the actual <tr> element using getRowElement() and compute 
everything from there, based on the element's offsetParent, offsetTop and 
offsetLeft.

BTW, depending on the browsers you need to support, you might be able to 
"just" use scrollIntoView with an options dictionary to center the cell: 
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

On Wednesday, May 13, 2020 at 11:49:34 PM UTC+2, Linus Kamb wrote:
>
> I have a DataGrid with a pager with a page size of 50 inside a 
> ScrollPanel.  When I ask the grid for the visible range, it give me a range 
> of 50 rows, the size of the page.   But what I can actually see at any 
> given time inside the ScrollPanel is often considerably fewer rows than the 
> page size.
>
> Is there any way to determine what rows and columns are *actually* visible 
> in the viewport of the ScrollPanel?
>
> The driver behind this is that I want to be able to programmatically 
> scroll a row+cell in to view, but I would like to scroll so the row+cell is 
> more or less in the center of the view, instead of just scrolled in to view 
> at the edge.  What I've tried to do is pick a row / column that is either 
> farther down / right or up / left so scroll in to view, but those 
> corrections depend on what is currently visible.
>
> Perhaps there is a "correct" way to do this.
>
> Thanks in advance.
> - 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 google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/1708b179-1b4e-4ee0-818b-a3448bf8c814%40googlegroups.com.

Reply via email to