From a2e297d28b6ae41c34aa1c7a5c8a7812cc71f0b6 Mon Sep 17 00:00:00 2001 From: nevermore Date: Fri, 3 Jan 2025 17:20:36 +0800 Subject: [PATCH 1/2] fix-7546 --- components/lib/datatable/DataTable.js | 9 +++++++-- components/lib/datatable/TableBody.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/lib/datatable/DataTable.js b/components/lib/datatable/DataTable.js index 2323dd701c..579c09d880 100644 --- a/components/lib/datatable/DataTable.js +++ b/components/lib/datatable/DataTable.js @@ -1642,7 +1642,7 @@ export const DataTable = React.forwardRef((inProps, ref) => { ); }; - const createTableBody = (options, selectionModeInColumn, empty, isVirtualScrollerDisabled) => { + const createTableBody = (options, selectionModeInColumn, empty, isVirtualScrollerDisabled, processedData) => { const first = getFirst(); const { rows, columns, contentRef, style, className, spacerStyle, itemSize } = options; @@ -1700,6 +1700,8 @@ export const DataTable = React.forwardRef((inProps, ref) => { onRowUnselect={props.onRowUnselect} onSelectionChange={props.onSelectionChange} paginator={props.paginator} + // pass processedData #7546 + processedData={processedData} reorderableRows={props.reorderableRows} responsiveLayout={props.responsiveLayout} rowClassName={props.rowClassName} @@ -1784,6 +1786,8 @@ export const DataTable = React.forwardRef((inProps, ref) => { onRowUnselect={props.onRowUnselect} onSelectionChange={props.onSelectionChange} paginator={props.paginator} + // pass processedData #7546 + processedData={processedData} reorderableRows={props.reorderableRows} responsiveLayout={props.responsiveLayout} rowClassName={props.rowClassName} @@ -1873,7 +1877,7 @@ export const DataTable = React.forwardRef((inProps, ref) => { }; const tableHeader = createTableHeader(options, empty, _isVirtualScrollerDisabled); - const tableBody = createTableBody(options, selectionModeInColumn, empty, _isVirtualScrollerDisabled); + const tableBody = createTableBody(options, selectionModeInColumn, empty, _isVirtualScrollerDisabled, processedData); const tableFooter = createTableFooter(options); const tableProps = mergeProps( { @@ -2020,6 +2024,7 @@ export const DataTable = React.forwardRef((inProps, ref) => { const footer = createFooter(); const resizeHelper = createResizeHelper(); const reorderIndicators = createReorderIndicators(); + const rootProps = mergeProps( { id: props.id, diff --git a/components/lib/datatable/TableBody.js b/components/lib/datatable/TableBody.js index f75acaf1a3..72afcd97da 100644 --- a/components/lib/datatable/TableBody.js +++ b/components/lib/datatable/TableBody.js @@ -354,7 +354,7 @@ export const TableBody = React.memo( let selection = []; for (let i = rowRangeStart; i <= rowRangeEnd; i++) { - let rangeRowData = props.value[i] ?? props.tableProps.value[i]; + let rangeRowData = props.processedData[i]; if (!isSelectable({ data: rangeRowData, index: i })) { continue; From 9f8094547989cde03f1c8dc006e3ff3f8e553dc9 Mon Sep 17 00:00:00 2001 From: nevermore Date: Fri, 3 Jan 2025 17:25:27 +0800 Subject: [PATCH 2/2] Remove extra blank lines --- components/lib/datatable/DataTable.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/lib/datatable/DataTable.js b/components/lib/datatable/DataTable.js index 579c09d880..baa3c9677b 100644 --- a/components/lib/datatable/DataTable.js +++ b/components/lib/datatable/DataTable.js @@ -2024,7 +2024,6 @@ export const DataTable = React.forwardRef((inProps, ref) => { const footer = createFooter(); const resizeHelper = createResizeHelper(); const reorderIndicators = createReorderIndicators(); - const rootProps = mergeProps( { id: props.id,