Reputation: 841
I have developed a paginating datatable component in my angular2 application with the help of this git code: https://github.com/mariuszfoltak/angular2-datatable
To achieve search/filter functionality for this I have created a pipe and passed it to template as below:
<tr *ngFor="let item of mf.data | filterPipe: searchTerm">
Search is working fine but the pagination at the bottom of the page is not updated. I think this will work if I can update 'data'. Can I get any suggestions to solve this issue.
Upvotes: 1
Views: 1479
Reputation: 11
Try using the filter directly on [mfData] as code below.
<table class="table table-striped" [mfData]="(singleData | search:searchText)" #mf="mfDataTable" [mfRowsOnPage]="10">
.
.
.
</table>
Upvotes: 1