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

Fixed #14432 #14433

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Fixed #14432 #14433

merged 1 commit into from
Jan 4, 2024

Conversation

fabiolucenaribas
Copy link
Contributor

@fabiolucenaribas fabiolucenaribas commented Dec 26, 2023

Performing the fix for the filters and maintaining the global filtering behavior

Copy link

vercel bot commented Dec 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Dec 26, 2023 8:53pm

@cetincakiroglu cetincakiroglu merged commit ed8f7b6 into primefaces:master Jan 4, 2024
2 checks passed
cetincakiroglu added a commit that referenced this pull request Mar 14, 2024
cetincakiroglu added a commit that referenced this pull request Mar 14, 2024
@cetincakiroglu
Copy link
Contributor

cetincakiroglu commented Mar 14, 2024

Hi,

You should use filterGlobal method instead of modifying filter method, it's not for global filtering. Please see the example: https://stackblitz.com/edit/github-8nu6jf?file=src%2Fapp%2Fapp.component.ts

I've reverted this PR in #15053 because it introduced new breaking changes in #14588 and #14903

@fabiolucenaribas
Copy link
Contributor Author

@cetincakiroglu

This is a filter-specific correction, solving the problem when there are multiple filters for the same field (complex), however I understand that it has generated an unintended impact on simple filters

this.filters[field] = field == 'global'? { value: value, matchMode: matchMode } : [{ value: value, matchMode: matchMode }];

    filter(value: any, field: string, matchMode: string) {
        if (this.filterTimeout) {
            clearTimeout(this.filterTimeout);
        }
        if (!this.isFilterBlank(value)) {
            this.filters[field] = { value: value, matchMode: matchMode };
            this.filters[field] = field == 'global'? { value: value, matchMode: matchMode } : [{ value: value, matchMode: matchMode }];
        } else if (this.filters[field]) {
            delete this.filters[field];
        }
        this.filterTimeout = setTimeout(() => {
            this._filter();
            this.filterTimeout = null;
        }, this.filterDelay);
        this.anchorRowIndex = null;
    }
    filterGlobal(value: any, matchMode: string) {
        this.filter(value, 'global', matchMode);
    }

The mention of the 'global' type within the filter function is to maintain the existing behavior given that the 'filterGlobal' function calls the 'filter'

    filterGlobal(value: any, matchMode: string) {
        this.filter(value, 'global', matchMode);
    }

It is necessary to look for a solution that meets both scenarios of #14433 and #14903,
#14433 In the example mentioned, the error occurred when the field in the interface has more than one filter

image

Expected outcome:

image

image

*I'm using the English translator, sorry if I don't express myself well

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

Successfully merging this pull request may close these issues.

3 participants