#3858 #3896 - fix row grouping with pagination #4011
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As detailed in #3858 and #3896, row grouping is not working with pagination. This is due to the
getRowIndex
function addingthis.first
to the row index.getRowIndex
is called by as part of theshouldRenderRowGroupHeader
call.The problem is that when pagination is enabled, the
DataTable
competent slices the data passed toTableBody
in thedataToRender
function, so the size of thevalue
array being passed toTableBody
is the page size.dataToRender
is being called when thevalue
prop is being passed toTableBody
.This means if the are
100
rows total, with a rows per page of20
, only20
rows get passed toTableBody
at any given time. If you were on page2
for example thegetRowIndex
function is addingthis.first
to theindex
, the index it is trying to compare would be20 + index
, which is out of range for thevalue
array of20
(max) items.The proposed fix in the PR is to simply stop adding
this.value
to the indexes. This has fixed the issue in my local testing.