react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

how do we implement and RESET Button for Filter Rows

Open pitla-df-mdsol opened this issue 6 years ago • 4 comments

i want functionality like this.can anyone help ? Screen Shot 2020-02-24 at 12 47 15 PM

pitla-df-mdsol avatar Feb 24 '20 07:02 pitla-df-mdsol

Toolbar accepts children so, change from: toolbar={<Toolbar enableFilter={true} />}

to this:

toolbar={<Toolbar enableFilter={true}>
        {child component responsible for clearing filter}
      </Toolbar>

for example if you have functional component:

<button type="button" class="btn" onClick={() => setFilters({})}>Reset filter</button>

But this will leave the text inside search fields...

emsi-iggy avatar Feb 29 '20 22:02 emsi-iggy

Then, How can we clear the text inside search fileds ?

"Reset filter" clears all the filters, but the filter mode is still on

pitla-df-mdsol avatar Mar 01 '20 10:03 pitla-df-mdsol

can you suggest the best approach for this ? Thanks !

pitla-df-mdsol avatar Mar 01 '20 10:03 pitla-df-mdsol

We have deprecated toolbar prop in V7 and improved the filter API. Please check this example on how to use filters and customize it.

https://github.com/adazzle/react-data-grid/blob/canary/stories/demos/HeaderFilters.tsx#L166

amanmahajan7 avatar Mar 09 '20 13:03 amanmahajan7