@@ -192,6 +192,10 @@ export const TableBody = React.memo(
192192 return options ? options [ option ] : null ;
193193 } ;
194194
195+ const getProcessedDataIndex = ( rowIndex ) => {
196+ return props . lazy ? rowIndex - props . first : rowIndex
197+ }
198+
195199 const findIndex = ( collection , rowData ) => {
196200 return ( collection || [ ] ) . findIndex ( ( data ) => equals ( rowData , data ) ) ;
197201 } ;
@@ -336,15 +340,17 @@ export const TableBody = React.memo(
336340 let rangeEnd ;
337341
338342 const isAllowCellSelection = allowCellSelection ( ) ;
339-
340- if ( rangeRowIndex . current > anchorRowIndex . current ) {
341- rangeStart = anchorRowIndex . current ;
342- rangeEnd = rangeRowIndex . current ;
343- } else if ( rangeRowIndex . current < anchorRowIndex . current ) {
344- rangeStart = rangeRowIndex . current ;
345- rangeEnd = anchorRowIndex . current ;
343+ const rangeRowIndexInProcessedData = getProcessedDataIndex ( rangeRowIndex . current ) ;
344+ const anchorRowIndexInProcessedData = getProcessedDataIndex ( anchorRowIndex . current ) ;
345+
346+ if ( rangeRowIndexInProcessedData > anchorRowIndexInProcessedData ) {
347+ rangeStart = anchorRowIndexInProcessedData
348+ rangeEnd = rangeRowIndexInProcessedData ;
349+ } else if ( rangeRowIndexInProcessedData < anchorRowIndexInProcessedData ) {
350+ rangeStart = rangeRowIndexInProcessedData ;
351+ rangeEnd = anchorRowIndexInProcessedData ;
346352 } else {
347- rangeStart = rangeEnd = rangeRowIndex . current ;
353+ rangeStart = rangeEnd = rangeRowIndexInProcessedData ;
348354 }
349355
350356 return isAllowCellSelection ? selectRangeOnCell ( event , rangeStart , rangeEnd ) : selectRangeOnRow ( event , rangeStart , rangeEnd ) ;
@@ -389,7 +395,7 @@ export const TableBody = React.memo(
389395 for ( let i = rowRangeStart ; i <= rowRangeEnd ; i ++ ) {
390396 let rowData = value [ i ] ;
391397 let columns = props . columns ;
392- let rowIndex = props . paginator ? i + props . first : i ;
398+ let rowIndex = props . lazy ? i + props . first : i ;
393399
394400 for ( let j = cellRangeStart ; j <= cellRangeEnd ; j ++ ) {
395401 let field = getColumnProp ( columns [ j ] , 'field' ) ;
@@ -920,7 +926,7 @@ export const TableBody = React.memo(
920926 } ;
921927
922928 const createGroupHeader = ( rowData , rowIndex , expanded , colSpan ) => {
923- if ( isSubheaderGrouping && shouldRenderRowGroupHeader ( props . value , rowData , rowIndex - props . first ) ) {
929+ if ( isSubheaderGrouping && shouldRenderRowGroupHeader ( props . value , rowData , getProcessedDataIndex ( rowIndex ) ) ) {
924930 const style = rowGroupHeaderStyle ( ) ;
925931 const toggler = props . expandableRowGroups && (
926932 < RowTogglerButton
0 commit comments