p-table: Combined filter and sorting doesn't detect changes to datasource #17133
Labels
Resolution: Help Wanted
Issue or pull request requires extra help and feedback
Milestone
Describe the bug
I have a p-table which is filled based on an api call. When changed the table ,for instance deleting a row, all data in the table is refreshed (the value bound to data is assigned with the results).
When I use a default sorting:
And a text filter on a different column:
Then deleting an item will not update the table, the deleted item is removed from the backend data, but no removed from the view. Changing the filter will remove it.
Manually triggering the filter from the component after changing the data does help (but it does break my global filter)
this.myTable['_filter']();
I believe this is a bug in the follow part of the code (ngOnChanges of p-table):
https://github.com/primefaces/primeng/blob/7f439a659a8e34d3b92ae1ad6366536229c6e36e/packages/primeng/src/table/table.ts#L1389C4-L1410C1
The ' else if (this.hasFilter())' only applies the filter if there is no sorting, but should apply it regardless (I can't tell if thee are any other replies).
Environment
Tested with: primeng 17.18.2
Checked code for 17.18.15 and 18.0.1 both contain this.
Reproducer
No response
Angular version
18.0.5
PrimeNG version
17.18.2, and later
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.0.1
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: