i have created a custom filterCostraints for p-table like this
Code: Select all
@ViewChild('dt') dtTable;
ngOnInit() {
this.dtTable.filterConstraints.currencyAmount = (value, filter: any): boolean => {
if (filter === undefined || filter === null || filter === '') {
return true;
}
if (value === undefined || value === null) {
return false;
}
return (<string>value.toFixed(2)).startsWith((<string>filter).replace(',', '.'));
};
}
there is any way to create this filter globally like "startsWith", "contains" .... to avoid the insert inside every ngOnInit?