user3878988
user3878988

Reputation: 841

search/filter component for angular2 datatables

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

Answers (1)

CykraLtd
CykraLtd

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

Related Questions