Closed opsmith96 closed 1 year ago
This has been discussed before - the virtualization algorithm is "non-greedy" when purging items outside the viewport. The range is recalculated only when the existing items are no longer filling in the viewport. If you open the console, you will notice that the top items (880) are still in the DOM.
Up to your case, you can listen to the onScroll event for that purpose.
ok, but I dont understand how onScroll is gonna help me get the index of the top visible element in the table in this position:
rangeChanged dont get called when only startIndex is changed. I have a table with different height items and when the bottom item is high and i scroll, the top item can change multiple rows but since bottom row dont change, the rangeChanged dont get called.
I store startIndex in the browser so i can keep scroll position to next time i open the table, when startIndex dont change its off by a bit
Reproduce https://codesandbox.io/s/react-virtuoso-rangechanged-hg6w00?file=/src/App.js
Expected behavior Expected rangeChanged to get called even when only startIndex is changed