table: Not able to disable filter for one column.
Hello !
I’m trying to disable the filter by adding the property “filterable:false” on one specific column , but i’m afraid that this is not working and the filter is shown anyway for that column. Here is my setup for the specific column:
const columns = [
{
header: '',
accessor:'contract_id',
filterable:false,
render: ({value}) => (<button className="btn " onClick={(e) => this.ShowContract(e, value)}>Ver</button>)
}
Any ideas why it is not working? Do i’m settting in the incorrect way or the option for disable filters is not working?
Thanks!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24
Hi,
I was able to disable filtering by adding it like this:
On Version 7:
In this case you disable sorting features on a column. Source: https://github.com/tannerlinsley/react-table/blob/master/docs/api.md#column-options-1
On version 7:
{ Header: 'First Name', accessor: 'firstName', disableFilters: true, }you need to use sortable:
And the column is no longer clickable.
Thanks this worked for me
disableSortBy: trueIn the columns object, include the disableGlobalFilter property with a boolean value like…
My react-table version is 7.7.0
See the section Column Options at the link below
https://react-table.tanstack.com/docs/api/useGlobalFilter#table-options
On v8:
columns = [{ accessor: ‘actions’, Header: ‘Actions’, width: 250, disableSortBy: true, disableFilters: true, },…] disableFilters: true is not working for React Table 7.7.0 disableSortBy: true is working as expected.
I dont understand why we mix disable filtering and disable sorting in this issue, topic was clearly about filtering…
I can confirm
disableFilters: trueworks on 7.7.0disableFilters: truenot working in v7.7@Horroon You could use
column.canSortto hide or show caret signsReference
disableSortBy: true Thanks worked for me but one thing still remain two caret signs after text remains there
Why is it tricky? It’s just a simple thing. I’m also having difficulty hiding columns by default whose value are empty, which also should be very simple but having difficulty getting it done. Any help here would be appreciated.
"react-table": "^7.0.0-rc.16",This will disable sorting for all columns.