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

Table: Advance Filtering is broken #15804

Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@rosenthalj
Copy link
Contributor

Describe the bug

Advance table filters that have been "previously" applied are automatically cleared when a user starts a filter dialog overlay and then closes the filter dialog by clicking outside of the dialog overlay.

The Video listed below demonstrates the issue using the current PrimeNG Advance Filter demo (https://primeng.org/table#filter-advanced):

advanceFiltersAutomaticallyCleared.mov

This issue was introduced with the closing of issue #15557 by PR #15594

The changes that were made for PR #15594 failed to take into account a filter may have already been previously defined before the filter dialog is "relaunched" and then closed without making any changes to the filter.

With Advance Table Filters, the actual "filter rule" is not visible. The only way for a user to see how a column filter is set is to display the column filter dialog. The user may not want to make any changes or "reapply" the current filter. This is a very common use case in my application.

Environment

max and windows

Reproducer

https://primeng.org/table#filter-advanced

Angular version

17.x

PrimeNG version

17.18.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18

Browser(s)

chrome, ff, safari

Steps to reproduce the behavior

  1. Start the PrimeNG Table Advanced Filter Demo: https://primeng.org/table#filter-advanced
  2. Filter the demo's table rows using any of the column filters (via the column filter dialog)
  3. Start the same filter dialog as step 2, but then immediately close the filter (without changing the filter) by clicking outside of the filter dialog
  4. The filter that was set in step 2 will automatically be cleared and all rows will be displayed

Expected behavior

After step 4, the filter should not be cleared and the table rows should remain filtered

@rosenthalj rosenthalj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 6, 2024
@rosenthalj
Copy link
Contributor Author

This bug was created when issue #15557 was attempted to be fixed by PR #15594. The issue of clearing the filters when a user doesn't apply the filter is very complicated. I have known about this PrimeNG issue for multiple years and believed there was no straight forward fix. i have spent a few hours trying to see if i could improve the changes introduced by PR #15594 and have failed to find a solution that both fixes this issue #15804 and at a minimum partially fixes #15557. The problem is that there are more than one advance filter (strings, date, multi-select, ...) and they all work slightly differently. Also, there are APIs provided by PrimeNG table that allow a developer to programmatically clear/reset filters. I believe the best short term solution is to just revert the changes made in PR#15594 until a "real" expert can fix this functionality.

@rosenthalj
Copy link
Contributor Author

I just reviewed issue: Component: Table (Advanced Filter) #15778. It's similar to the this issue, but not identical. I also confirmed that the problem was caused by the changes made to PR#15594

@RogueTea
Copy link
Contributor

RogueTea commented Jun 7, 2024

Hello, I'm currently looking into this and I think I have a rough solution but would be great to hear your thoughts.
Link to the draft PR
Some more manual testing, code cleanup and unit test needs to be done but It would be great to get some more eyes on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
2 participants