Skip to content

Commit

Permalink
docs: typo in multi-sorting guide (#5686)
Browse files Browse the repository at this point in the history
Co-authored-by: trietlam <triet@conqahq.com>
  • Loading branch information
trietlam and trietlam authored Aug 3, 2024
1 parent a669e39 commit 2c74877
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 2c74877

Please sign in to comment.