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

DateInput in FilterButton component cannot be removed if value is not empty #9860

Open
dmitrisi4 opened this issue May 21, 2024 · 1 comment

Comments

@dmitrisi4
Copy link

In lists in the TopToolbar component in FilterButton -> DateInput it is impossible to delete if the value is not empty
You have to open the calendar, click the Clear button and only then the filter delete button works

<List {...props} title="List" filters={clientFilters()} actions={<ClientListActions />}> <DatagridConfigurable bulkActionButtons={<CrmLeadListBulkActionButtons/>}> {ClientsListFields(dataOwners)} </DatagridConfigurable> </List>

`
const LeadListActions = () => {
const { setFilters, displayedFilters } = useListContext();
const isFiltersMoreOne = Object.keys(displayedFilters).length > 1;

return (<TopToolbar>
    <FilterButton filters={clientFilters()}/>
    <SelectColumnsButton/>
    <ExportButton/>
    {isFiltersMoreOne ? <Button onClick={() => setFilters({}, {})} label="Remove all filters"></Button>: null}
</TopToolbar>);

};
`

const clientFilters = () => { return [ <DateInput source="clientProfile.dateRegister" key="filter_1" label="Register Since"/>, ] }
Screenshot 2024-05-21 at 09 44 56

Environment

  • React-admin version: checked on 4.14.4 and 4.16.17
  • Last version that did not exhibit the issue (if applicable):
  • React version: react@^18.0.0: and react@^18.3.1
  • Browser: Chrome
@adguernier
Copy link
Contributor

I'm not sure I understand the issue if there is one. Could you please follow the issue template:

  • What you were expecting
  • What happened instead
  • Steps to reproduce
  • Related code
  • Other information

Please also provide a reproducible example by forking a sandbox from https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple. This will help a lot. Thanks

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

No branches or pull requests

2 participants