bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.1k stars 3.05k forks source link

Access to Multigrid public method recomputeGridSize() returns undefined #1818

Open DNikolic-Paycor opened 1 year ago

DNikolic-Paycor commented 1 year ago

I am having issues to access recomputeGridSize() public method from Multigrid component with refs in React functional ccomponent. I checked this issue https://github.com/bvaughn/react-virtualized/issues/136 but solution from there does not work for me and i am still getting undefined. In short hand my code looks something like this: ` import { MultiGrid } from 'react-virtualized';

const SomeComponent=()=>{ const multiGridRef = useRef(); return ( <MultiGrid onScroll={handleScroll} width={headerRef?.current?.offsetWidth || 0} height={multiGridHeight + 10} fixedColumnCount={ stickyColumnsCount || stickyColumns.length } rowHeight={ROW_HEIGHT} columnWidth={(index) => table.visibleColumns[index.index]?.totalFlexWidth || 0 } cellRenderer={renderCell} rowCount={table.rows.length} columnCount={visibleColumnsCount} ref={multiGridRef} /> ); } ` If i console.log() multiGridRef?.current i will get:

conslosslls

I tried to access this method as multiGridRef.recomputeGridSize() and multiGridRef.current.recomputeGridSize() but both are undefined. I really need help about this! Thanks in advance!