TanStackT
TanStack4y ago
1 reply
rubber-blue

getCanSort() returning false

I have a simple table built by passing in a data and column object from json data to useReactTable
in the TableWidget.js file there are two // todo - ... comments outlining issues I'm having

the first and main one being that I am unable to sort any of the columns as canGetSort is retunring false

I have a hunch that the issue may be to do with with definitions missing from my mockTableColumns.json file, but after trying many options like, adding an enableSorting flag etc. I am stumped
{
    "id": "orderid",
    "header": "Order ID",
    "accessor": "orderid",
    "enableSorting": true       <==========
}


the second is that the way of rendering cells in the example was leaving me with blank cells.

It's probably worth noting that I am not using the createColumnHelper function as I couldnt figure out its usage for dynamic column structures defined by json data that could be refreshed as opposed to static column data that can be defined in code the same way it is in the docs examples

https://codesandbox.io/s/great-hamilton-e1vdnl?file=/src/components/TableWidget.js
CodeSandboxjarrednorrisdev
great-hamilton-e1vdnl by jarrednorrisdev using @chakra-ui/react, @emotion/react, @emotion/styled, @tanstack/react-table, react, react-dom, react-icons, react-scripts
great-hamilton-e1vdnl - CodeSandbox
Was this page helpful?