[英]How to disable sort in React table?
Disable sorting for a particular column is not working, I have used the method from documentation https://react-table.tanstack.com/docs/api/useSortBy禁用特定列的排序不起作用,我使用了文档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'
}
]
You are using string value:您正在使用字符串值:
disableSortBy: 'true'
You should use boolean value instead:您应该改用 boolean 值:
disableSortBy: true
With TanStack v8, you have enableSorting: false,
now in the columnHelper.accessor that does the job使用 TanStack v8,您有
enableSorting: false,
现在在完成这项工作的 columnHelper.accessor 中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.