Skip to content

Custom column filter #13

Answered by KevinVandy
Janekk asked this question in Q&A
Jul 1, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You can pass in a custom Filter component on a column definition. I have this example in the storybook from a while ago for a custom select https://www.material-react-table.dev/?path=/story/features-filtering-examples--custom-filter-component

const columns={[
      {
        header: 'First Name',
        id: 'firstName',
      },
      {
        header: 'Last Name',
        id: 'lastName',
      },
      {
        header: 'Age',
        id: 'age',
      },
      {
        header: 'Gender',
        id: 'gender',
        Filter: ({ header }) => (
          <TextField
            onChange={(e) =>
              header.column.setFilterValue(e.target.value || undefined)
            }
            

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SRGajjala
Comment options

@KevinVandy
Comment options

Answer selected by KevinVandy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants