Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
10 changes: 2 additions & 8 deletions components/lib/datatable/TableBody.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -891,12 +891,6 @@ export const TableBody = React.memo(
}
});

useUpdateEffect(() => {
if (props.paginator && isMultipleSelection()) {
anchorRowIndex.current = null;
}
}, [props.first]);

useUnmountEffect(() => {
if (props.dragSelection) {
unbindDragSelectionEvents();
Expand Down
4 changes: 4 additions & 0 deletions components/lib/datatable/datatable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,10 @@ interface DataTableBaseProps<TValue extends DataTableValueArray> extends Omit<Re
* An array of SortMeta objects to sort the data by default in multiple sort mode.
*/
multiSortMeta?: DataTableSortMeta[] | null | undefined;
/**
* Defines whether a range selection can cover multiple pages.
*/
multiPageRangeSelection?: boolean;
/**
* Number of page links to display.
* @defaultValue 5
Expand Down
Loading