diff --git a/components/lib/datatable/DataTable.js b/components/lib/datatable/DataTable.js index c8aa4b56f8..f3416f967a 100644 --- a/components/lib/datatable/DataTable.js +++ b/components/lib/datatable/DataTable.js @@ -1713,6 +1713,7 @@ export const DataTable = React.forwardRef((inProps, ref) => { lazy={props.lazy} loading={props.loading} metaKeySelection={props.metaKeySelection} + multiPageRangeSelection={props.multiPageRangeSelection} onCellClick={props.onCellClick} onCellSelect={props.onCellSelect} onCellUnselect={props.onCellUnselect} @@ -1799,6 +1800,7 @@ export const DataTable = React.forwardRef((inProps, ref) => { lazy={props.lazy} loading={props.loading} metaKeySelection={props.metaKeySelection} + multiPageRangeSelection={props.multiPageRangeSelection} onCellClick={props.onCellClick} onCellSelect={props.onCellSelect} onCellUnselect={props.onCellUnselect} diff --git a/components/lib/datatable/TableBody.js b/components/lib/datatable/TableBody.js index e6682d3eea..d880fbf27c 100644 --- a/components/lib/datatable/TableBody.js +++ b/components/lib/datatable/TableBody.js @@ -1,7 +1,7 @@ import * as React from 'react'; import { localeOption } from '../api/Api'; import { ColumnBase } from '../column/ColumnBase'; -import { useMergeProps, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks'; +import { useMergeProps, useUnmountEffect } from '../hooks/Hooks'; import { DomHandler, ObjectUtils } from '../utils/Utils'; import { BodyRow } from './BodyRow'; import { RowTogglerButton } from './RowTogglerButton'; @@ -174,7 +174,7 @@ export const TableBody = React.memo( }; const allowRangeSelection = (event) => { - return isMultipleSelection() && event.originalEvent.shiftKey && anchorRowIndex.current !== null; + return isMultipleSelection() && event.originalEvent.shiftKey && anchorRowIndex.current !== null && (anchorRowFirst.current === props.first || (props.multiPageRangeSelection && !props.lazy)); }; const allowRowSelection = () => { @@ -891,12 +891,6 @@ export const TableBody = React.memo( } }); - useUpdateEffect(() => { - if (props.paginator && isMultipleSelection()) { - anchorRowIndex.current = null; - } - }, [props.first]); - useUnmountEffect(() => { if (props.dragSelection) { unbindDragSelectionEvents(); diff --git a/components/lib/datatable/datatable.d.ts b/components/lib/datatable/datatable.d.ts index 0ca0e2c40d..ae1e02b22d 100644 --- a/components/lib/datatable/datatable.d.ts +++ b/components/lib/datatable/datatable.d.ts @@ -1285,6 +1285,10 @@ interface DataTableBaseProps extends Omit