I am using angular 2 component ng2-smart-table and was looking for a way to filter the records by range, for example if I have an age column I would like it to be filtered like ">90 or <90" instead of "like '90'". I looked around various forums but was unable to find such a way.
This is how I was able to apply a custom filter on the cell, doing so would call this function whenever a user would attempt to filter based on a particular column.
Example:
columns: {
totalRows: {
title: 'Total Rows',
type: 'number',
filterFunction(cell?: any, search?: string): boolean {
if (cell >= search || search === '') {
return true;
} else {
return false;
}
}
}
This documentation on ng2-smart-table can be very helpful as well : documentation