Skip to content

Commit

Permalink
Fix primefaces#3009: Datatable add virtualScrollerRef
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jun 29, 2022
1 parent ad504a3 commit 09311e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const DataTable = React.forwardRef((props, ref) => {
const elementRef = React.useRef(null);
const tableRef = React.useRef(null);
const wrapperRef = React.useRef(null);
const virtualScrollerRef = React.useRef(null);
const reorderIndicatorUpRef = React.useRef(null);
const reorderIndicatorDownRef = React.useRef(null);
const colReorderIconWidth = React.useRef(null);
Expand Down Expand Up @@ -1431,7 +1432,7 @@ export const DataTable = React.forwardRef((props, ref) => {

return (
<div ref={wrapperRef} className="p-datatable-wrapper" style={{ maxHeight: _isVirtualScrollerDisabled ? props.scrollHeight : null }}>
<VirtualScroller {...virtualScrollerOptions} items={processedData} columns={columns} scrollHeight={props.scrollHeight}
<VirtualScroller ref={virtualScrollerRef} {...virtualScrollerOptions} items={processedData} columns={columns} scrollHeight={props.scrollHeight}
disabled={_isVirtualScrollerDisabled} loaderDisabled showSpacer={false}
contentTemplate={(options) => {
const ref = (el) => { tableRef.current = el; options.spacerRef && options.spacerRef(el) };
Expand Down

0 comments on commit 09311e7

Please sign in to comment.