Skip to content

Commit

Permalink
Fixed global filter when manual paginating (#307)
Browse files Browse the repository at this point in the history
Problem:
If `manualPagination` is `true`, the current `rows` function for the `TableBody` component improperly performs a `slice` on the search results.

Proposed fix:
The user is already handling pagination manually, there is no need to perform an additional slice to accommodate the default pagination logic.
  • Loading branch information
duckboy81 authored Jan 10, 2023
1 parent a60ffd8 commit c10419b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/material-react-table/src/body/MRT_TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const MRT_TableBody: FC<Props> = ({
layoutMode,
localization,
manualFiltering,
manualPagination,
manualSorting,
memoMode,
muiTableBodyProps,
Expand Down Expand Up @@ -75,7 +76,7 @@ export const MRT_TableBody: FC<Props> = ({
const rankedRows = getPrePaginationRowModel().rows.sort((a, b) =>
rankGlobalFuzzy(a, b),
);
if (enablePagination) {
if (enablePagination && !manualPagination) {
const start = pagination.pageIndex * pagination.pageSize;
return rankedRows.slice(start, start + pagination.pageSize);
}
Expand Down

2 comments on commit c10419b

@vercel
Copy link

@vercel vercel bot commented on c10419b Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c10419b Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.