I have a GWT CellTable contained in a ScrollPanel. The CellTable is set to use a SingleSelectionModel<T> I am programatically setting the selected row, which is working fine. However, the cell table isn’t scrolled to the selected row. Is there a way I can both select the row and scroll so the selected row is visible?
I have a GWT CellTable contained in a ScrollPanel . The CellTable is set
Share
Andrei was on the right track, but setScrollTop(int) gives the number of pixels to scroll, not the index to scroll to. What works is:
this adjusts the scrolling so that the element is in view. Note that if your table scrolls horizontally, scrollIntoView() will scroll it all the way to the right in an attempt to show all of the cell. I didn’t want this behavior, so I subsequently called: