disable sort in react-table
Solution 1:
Use the useSortBy
hook with the disableSortBy
option:
let {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
page,
canPreviousPage,
canNextPage,
nextPage,
previousPage,
state: { pageIndex, sortBy }
} = useTable(
{
columns,
data,
manualPagination: true,
manualSortBy: true,
disableSortBy: dsiabledSort // Add disableSortBy here
},
useSortBy,
usePagination
);
Solution 2:
On Version 7 if you want to disable sort on a single column use disableSortBy
on columns definition, for example:
{
Header: 'Column Title',
accessor: 'title',
disableSortBy: true
}