Search code examples
reactjsreact-table

Is it possible not to make all columns filterable in React table


I am working on implementation filter method in react table. If I add filterable attribute it gives me filter input in all columns but I want not to add filter input in specific column.

Is there any solution about this?


Solution

  • If you want a specific column to not be filterable, you can specifiy it when creating your columns like this :

    const columns = [
      {
        Header: 'NotFilterableColumn',
        accessor: 'notFilterable',
        filterable: false  //This makes the column not filterable
      },
      {
        Header: 'FilterableColumn',
        accessor: 'filterable',
      }
    ]
    

    So that giving the filterable attribute to your ReactTable will not make the NotFilterableColumn filterable :) (in other words, the column will not have the filter input)