After upgrading Angular to v15 I am getting this error:
Module '"primeng/utils"' has no exported member 'FilterUtils'.
Is there any alternative of filtering like this without code changes?
import { FilterUtils } from 'primeng/utils';
filterStatus(event: Switch, dt: Table): void {
this.showErrorOnly = event.checked;
if (event.checked) {
dt.value = FilterUtils.filter(this.data, ['validation.status'], 'INVALID', 'contains');
} else {
dt.value = this.data;
}
dt.reset()
}
FilterUtils
were removed in PrimeNG 11 and the FilterService
class was provided as the replacement:
import { FilterService } from 'primeng/api';
@Component({
...
providers: [FilterService] // you can also provide it globally in the AppModule
})
class SomeComponent {
constructor (private readonly filterService: FilterService) {}
filterStatus(event: Switch, dt: Table): void {
this.showErrorOnly = event.checked;
if (event.checked) {
dt.value = this.filterService.filter(this.data, ['validation.status'], 'INVALID', 'contains');
} else {
dt.value = this.data;
}
dt.reset();
}
}