Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.
Merged
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
26 changes: 10 additions & 16 deletions components/lib/datatable/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@ export const TableBody = React.memo(
return options ? options[option] : null;
};

const getProcessedDataIndex = (rowIndex) => {
return props.lazy ? rowIndex - props.first : rowIndex;
};

const findIndex = (collection, rowData) => {
return (collection || []).findIndex((data) => equals(rowData, data));
};
Expand Down Expand Up @@ -355,17 +351,15 @@ export const TableBody = React.memo(
let rangeEnd;

const isAllowCellSelection = allowCellSelection();
const rangeRowIndexInProcessedData = getProcessedDataIndex(rangeRowIndex.current);
const anchorRowIndexInProcessedData = getProcessedDataIndex(anchorRowIndex.current);

if (rangeRowIndexInProcessedData > anchorRowIndexInProcessedData) {
rangeStart = anchorRowIndexInProcessedData;
rangeEnd = rangeRowIndexInProcessedData;
} else if (rangeRowIndexInProcessedData < anchorRowIndexInProcessedData) {
rangeStart = rangeRowIndexInProcessedData;
rangeEnd = anchorRowIndexInProcessedData;

if (rangeRowIndex.current > anchorRowIndex.current) {
rangeStart = anchorRowIndex.current;
rangeEnd = rangeRowIndex.current;
} else if (rangeRowIndex.current < anchorRowIndex.current) {
rangeStart = rangeRowIndex.current;
rangeEnd = anchorRowIndex.current;
} else {
rangeStart = rangeEnd = rangeRowIndexInProcessedData;
rangeStart = rangeEnd = rangeRowIndex.current;
}

return isAllowCellSelection ? selectRangeOnCell(event, rangeStart, rangeEnd) : selectRangeOnRow(event, rangeStart, rangeEnd);
Expand Down Expand Up @@ -410,7 +404,7 @@ export const TableBody = React.memo(
for (let i = rowRangeStart; i <= rowRangeEnd; i++) {
let rowData = value[i];
let columns = props.columns;
let rowIndex = props.lazy ? i + props.first : i;
let rowIndex = props.paginator ? i + props.first : i;

for (let j = cellRangeStart; j <= cellRangeEnd; j++) {
let field = getColumnProp(columns[j], 'field');
Expand Down Expand Up @@ -941,7 +935,7 @@ export const TableBody = React.memo(
};

const createGroupHeader = (rowData, rowIndex, expanded, colSpan) => {
if (isSubheaderGrouping && shouldRenderRowGroupHeader(props.value, rowData, getProcessedDataIndex(rowIndex))) {
if (isSubheaderGrouping && shouldRenderRowGroupHeader(props.value, rowData, rowIndex - props.first)) {
const style = rowGroupHeaderStyle();
const toggler = props.expandableRowGroups && (
<RowTogglerButton
Expand Down
Loading