Unable to scroll to row?
jakub-astrahit opened this issue · 2 comments
Is there a way I can tell the table to scroll to a given row? For example, I have a table with 20 000 rows and I want to scroll to row number 4500. I couldn't find anything like this in the docs and/or in the issues here.
I was able to do this changing scrollTop of a specific div element that is parent of the second table (the body). Here my rows have fixed height of 43px, then pass the number of rows you want to scroll, and add or subtract depending if you want scroll down or up. Also give an ID to the Window Table element.
var parent = document.getElementById("myTable").childNodes[1];
var scrollDiv = parent.lastChild;
scrollDiv.scrollTop += 43 * numberOfLinesToScroll;
That doesn't really seem like the best solution. The underlying library support this.This package should too https://react-window.now.sh/#/examples/list/scroll-to-item