Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a 'Reset filters' button #816

Closed
gandrin opened this issue Jul 3, 2017 · 10 comments
Closed

Create a 'Reset filters' button #816

gandrin opened this issue Jul 3, 2017 · 10 comments

Comments

@gandrin
Copy link

gandrin commented Jul 3, 2017

Hello,

I have an issue with filters on the list page.
I'm using DateInput fields to create a "between" like filter. To manage display both input fields (From and To), I had to use the alwaysOn property.

However, I cannot empty the DateInput to reset the filters and display all my models.
A button reset filters would solve this by resetting the current chosen filters.

Thanks for your help.

@remi13131
Copy link

@fzaninotto
Copy link
Member

Duplicate of #817

@gandrin
Copy link
Author

gandrin commented Jul 5, 2017

@fzaninotto I won't consider it as a duplicate. Indeed the two issues are related with a common objective at first (the between filter). However, the features are different and this one can be used to clean all the filters with 1 click.

@fzaninotto
Copy link
Member

OK, it's not a duplicate.

But I don't want to implement this in the core - it will clutter the interface even more, unless a UX master shows me the contrary.

You should be able to do that via a custom <Filter> component in userland, though.

@nickgrealy
Copy link

nickgrealy commented Nov 26, 2020

Here's how I created a "Clear Filters" button ("react-admin": "3.10.2").

Extending upon the custom ListActions toolbar example...

import { FilterList } from "@material-ui/icons";
import React from "react";
import {
    Button,
    sanitizeListRestProps,
    TopToolbar
} from "react-admin";

const ListActionsTopToolbar = (props) => {
  const {
    className,
    exporter,
    filters,
    maxResults,
    setFilters,
    ...rest
  } = props;
  return (
    <TopToolbar className={className} {...sanitizeListRestProps(rest)}>
        
        {/* Clear Filters Button */}
      <Button onClick={() => setFilters({})} label="Clear Filters">
        <FilterList />
      </Button>

    </TopToolbar>
  );
};

StackOverflow: https://stackoverflow.com/a/65015214/782034

@ghost
Copy link

ghost commented Nov 16, 2021

I don't understand not implementing an obvious feature just because it would clutter up the interface. It could easily be put into an overflow menu.

@djhi
Copy link
Collaborator

djhi commented Nov 16, 2021

Well, here's what I suggest: open a pull request implementing this button, with tests and screencasts/screenshots of the results. In the event we end up choosing to not include it, you will then be able to keep the code and open source it as an addon package.

@ghost
Copy link

ghost commented Nov 16, 2021

Thank you for your suggestion.

Here's what I suggest: Listen to your users and appreciate the feedback that they've taken the time to give to you.

@hiaselhans
Copy link
Contributor

i think this finally lands in 4.3 with #8017

@qpointsystems
Copy link

Came here looking for others on same path. Happy to hear this finally made the cut, feature wise. Tricky UIX wise... but, as they say, where there is a will, there is a way ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants