Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: typo in multi-sorting guide #5686

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const table = useReactTable({
getSortedRowModel: getSortedRowModel(),
sortingFns: { //add a custom sorting function
myCustomSortingFn: (rowA, rowB, columnId) => {
return rowA.original[columnId] > rowB.original[columnId] ? 1 : rowA.original[columnId] < rowB.original[columnId] ? -1 : 0
return rowA.original[columnId] > rowB.original[columnId] ? 1 : rowA.original[columnId] < rowB.original[columnId] ? -1 : 0
},
},
})
Expand Down Expand Up @@ -308,7 +308,7 @@ const columns = [

By default, the ability to remove sorting while cycling through the sorting states for a column is enabled. You can disable this behavior using the `enableSortingRemoval` table option. This behavior is useful if you want to ensure that at least one column is always sorted.

The default behavior when using either the `getToggleSortingHandler` or `toggleSorting` APIs is to cycle through the sorting states like this:
The default behavior when using either the `getToggleSortingHandler` or `toggleSorting` APIs is to cycle through the sorting states like this:

`'none' -> 'desc' -> 'asc' -> 'none' -> 'desc' -> 'asc' -> ...`

Expand All @@ -334,22 +334,22 @@ Sorting by multiple columns at once is enabled by default if using the `column.g

##### Disable Multi-Sorting

You can disable multi-sorting for either a specific column or the entire table using the `enableMultiSorting` column option or table option. Disabling multi-sorting for a specific column will replace all existing sorting with the new column's sorting.
You can disable multi-sorting for either a specific column or the entire table using the `enableMultiSort` column option or table option. Disabling multi-sorting for a specific column will replace all existing sorting with the new column's sorting.

```jsx
const columns = [
{
header: () => 'Created At',
accessorKey: 'createdAt',
enableMultiSorting: false, // always sort by just this column if sorting by this column
enableMultiSort: false, // always sort by just this column if sorting by this column
},
//...
]
//...
const table = useReactTable({
columns,
data,
enableMultiSorting: false, // disable multi-sorting for the entire table
enableMultiSort: false, // disable multi-sorting for the entire table
})
```

Expand Down