Skip to content

Commit

Permalink
Update the order of operations for pagination example so that slicin…
Browse files Browse the repository at this point in the history
…g takes place after sorting. (#34189)

Signed-off-by: Marceli Wac <[email protected]>
  • Loading branch information
marceliwac authored Oct 20, 2022
1 parent 8a584fd commit 32c33b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/data/material/components/tables/EnhancedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default function EnhancedTable() {
/>
<TableBody>
{/* if you don't need to support IE11, you can replace the `stableSort` call with:
rows.slice().sort(getComparator(order, orderBy)) */}
rows.sort(getComparator(order, orderBy)).slice() */}
{stableSort(rows, getComparator(order, orderBy))
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row, index) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/tables/EnhancedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export default function EnhancedTable() {
/>
<TableBody>
{/* if you don't need to support IE11, you can replace the `stableSort` call with:
rows.slice().sort(getComparator(order, orderBy)) */}
rows.sort(getComparator(order, orderBy)).slice() */}
{stableSort(rows, getComparator(order, orderBy))
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row, index) => {
Expand Down

0 comments on commit 32c33b5

Please sign in to comment.