Is it possible to access the row virtualizer instance? #45
-
I have a table with Looking through the source code, it looks like a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Edit: There is now a So there is currently no reference to the virtualizer currently, though I could probably expose a ref to it. If all you are wanting to do is scroll to the top, you could do that with the Something like this const tableContainerRef = useRef(null);
//scroll to top of table when sorting or filters change
useEffect(() => {
if (tableContainerRef.current) {
tableContainerRef.current.scrollTop = 0;
}
}, [sorting, columnFilters, globalFilter]);
...
<MaterialReactTable
muiTableContainerProps={{
ref: tableContainerRef
}}
/> But adding a virtualizerRef to the library itself is probably a good idea and not too dangerous. I'll see if that works and maybe add it soon. |
Beta Was this translation helpful? Give feedback.
Edit: There is now a
virutalizerInstanceRef
prop. It can be seen used in the infinite scrolling exampleSo there is currently no reference to the virtualizer currently, though I could probably expose a ref to it.
If all you are wanting to do is scroll to the top, you could do that with the
muiTableContainerProps
ref.Something like this
But adding a …