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

DataTable: filters are not rerendered when their state is changed #1352

Closed
VsevolodGolovanov opened this issue Apr 29, 2020 · 4 comments
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@VsevolodGolovanov
Copy link

VsevolodGolovanov commented Apr 29, 2020

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

https://codesandbox.io/s/primereact-test-0c3wq

Current behavior
When changing the controlled state of DataTable filters, the changes affect displayed data in the table, but the filter fields themselves are not updated.

Expected behavior
The filter fields are updated to show their current state.

Minimal reproduction of the problem with instructions
Open the linked codesandbox.
Type something in both the column filter and the global filter.
Press the reset button.
Notice how data in the table is unfiltered and visible again, but filter fields still show the values that you typed in.

image

Please tell us about your environment:
Win10, WebStorm.

  • React version:
    16.13.1, 16.8.0.

  • PrimeReact version:
    4.1.2, 4.2.0.

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Firefox 75.

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

@mertsincan mertsincan self-assigned this Apr 30, 2020
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Apr 30, 2020
@mertsincan mertsincan added this to the 4.2.1 milestone Apr 30, 2020
@mertsincan
Copy link
Member

To reset globalFilter input, please use;

...
    const header = (
        <>
        <InputText
            type="search"
            value={this.state.globalFilter}
            onChange={e => this.setState({ globalFilter: e.currentTarget.value })}
            placeholder="Global filter"
            size={30}
        />
        <Button
            label="Reset all filters"
            onClick={() => this.setState({ filters: {}, globalFilter: "" })}
        />
        </>
    );
...

@VsevolodGolovanov
Copy link
Author

Ah, I forgot to bind InputText's value. My mistake.

@andhure
Copy link

andhure commented Jun 2, 2020

Is there a way we can reset filter text box of individual columns using a reset function? I understand that it is possible for global filters.

@andhure
Copy link

andhure commented Jun 3, 2020

Got it. It is fixed in 4.2.1. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants