1

Disable sorting for a particular column is not working, I have used the method from documentation https://react-table.tanstack.com/docs/api/useSortBy

export const COLUMNS = [
    {
        Header: 'Avatar',
        accessor: 'avatar',
        maxWidth: 50,
        minWidth: 50,
    Cell: ({ cell: { value } }) => (
      <img
        src={value}
        width={60}
      />
    )


    },
    {
        Header: 'Name',
        accessor: 'name', 
        Filter:ColumnFilter,
        disableSortBy:'true'
        

    }
]

3 Answers 3

4

You are using string value:

disableSortBy: 'true'

You should use boolean value instead:

disableSortBy: true

Sign up to request clarification or add additional context in comments.

Comments

0

With TanStack v8, you have enableSorting: false, now in the columnHelper.accessor that does the job

Comments

0

in "react-table": "6.11.5":

sortable: boolean

in either the table or the column props

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.