-
-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Labels
V2Issue with MRT V2Issue with MRT V2
Description
mantine-react-table version
2.0.0-beta.7
react & react-dom versions
18.2.0
Describe the bug and the steps to reproduce it
Hello, i'm using a table with enableRowVirtualization set to true, i have injected a rowVirtualizerInstanceRef to the table and i'm using the method rowVirtualizerInstanceRef.current?.scrollToIndex(rowIndex) the problem is it does the scroll but it doesn't scroll to the exact index, i tried several params for the scrollToIndex method but the result is always the same
Minimal, Reproducible Example - (Optional, but Recommended)
const Component = (props) => {
const rowVirtualizerInstanceRef = useRef<MRT_RowVirtualizer>(null)
useEffect(() => {
if (props.expandedRowId) {
const rowIndex = props.data.findIndex(row => row.invariant === props.expandedRowId)
setExpanded({ [rowIndex]: true })
rowVirtualizerInstanceRef.current?.scrollToIndex(rowIndex)
}
}, [props.expandedRowId])
return (
<MantineProvider
defaultColorScheme={darkTheme ? 'dark' : 'light'}
forceColorScheme={darkTheme ? 'dark' : 'light'}>
<MantineReactTable
localization={MRT_Localization_FR}
columns={columns}
data={props.data}
layoutMode='grid'
enablePagination={false}
enableTopToolbar={true}
enableStickyHeader={true}
enableRowVirtualization={true}
rowVirtualizerInstanceRef={rowVirtualizerInstanceRef}
state={{
density: 'xs'
}}
mantineTableContainerProps={{
style: { height: '60vh' }
}}
/>
</MantineProvider>)
}Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms
- I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Metadata
Metadata
Assignees
Labels
V2Issue with MRT V2Issue with MRT V2