I've been trying to get this working with no luck. I've been referencing these resources for help:
http://swimlane.github.io/ngx-datatable/#filter
https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/filter.component.ts
Basically i just want to allow my filter to apply to more than a single column, without implementing code to handle every column. (Some datatables have 20+ columns!)
Example Code:
//HTML
<input type='text' placeholder='Filter' (keyup)='updateFilter($event.target.value)' />
<ngx-datatable
class="material"
columnMode="force"
[columns]="gridProperties.FilteredColumns"
[footerHeight]="50"
[loadingIndicator]="gridLoadingIndicator"
[rows]="filteredList"
[scrollbarH]="false"
[scrollbarV]="true"
[selected]="selectedItem"
[selectionType]="'single'"
style="min-height:400px;">
</ngx-datatable>
//TYPESCRIPT
public items: Item[];
updateFilter(filterValue) {
const lowerValue = filterValue.toLowerCase();
this.filteredList = this.items.filter(item => item.name.toLowerCase().indexOf(lowerValue) !== -1 || !lowerValue);
}
Here I am obviously just handling filtering for the 'name' property of my items array. This works great as is, but like I had mentioned, if the grid contains many columns I'd like one method to handle all of them. Any help or tips are appreciated.