Zolf
asked on
Angular 2 Pagination not working
Hello there,
I am trying to implement angular2-datatable from https://github.com/mariuszfoltak/angular2-datatable/blob/master/README.md in to my application. But for some reason the rowsOnPage is not taking the number i assign to it. For e.g. when I say show 5 records on a page, it shows all the records. Dont know what I am missing. Can someone please help me resolve it.
I am trying to implement angular2-datatable from https://github.com/mariuszfoltak/angular2-datatable/blob/master/README.md in to my application. But for some reason the rowsOnPage is not taking the number i assign to it. For e.g. when I say show 5 records on a page, it shows all the records. Dont know what I am missing. Can someone please help me resolve it.
<table class="table table-striped table-hover" [mfData]="products | SearchPipe : searchText" #mf="mfDataTable" [mfRowsOnPage]="5">
<thead>
<tr>
<th>
<mfDefaultSorter by="gt">GT</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="name_e">Name E</mfDefaultSorter>
</th>
<th class="no-sort hidden-sm-down">
<mfDefaultSorter by="name_z">Name Z</mfDefaultSorter>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let product of products | SearchPipe : searchText">
<td><a [routerLink]="['/app/master/products',product.gtin]">{{product.gt}}</a></td>
<td>{{product.name_e}}</td>
<td>{{product.name_z}}</td>
<td>
<a class="btn btn-primary" [routerLink]="['/app/master/productEdit', product.gt]">
Edit
</a>
</td>
</tr>
<tr *ngIf="!products.length">
<td> </td>
<td colspan="6">No Records Found</td>
</tr>
<tr *ngIf="(products | SearchPipe : searchText).length === 0">
<td> </td>
<td colspan="6">No matches</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="12">
<mfBootstrapPaginator [rowsOnPageSet]="[5, 10, 15]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
the demo here works with hardcoded number...
http://plnkr.co/edit/PxBaZs?p=preview
[mfRowsOnPage]="rowsOnPage "
>>>
[mfRowsOnPage]="5"
do you see any data? How many records do you see?
http://plnkr.co/edit/PxBaZs?p=preview
[mfRowsOnPage]="rowsOnPage
>>>
[mfRowsOnPage]="5"
do you see any data? How many records do you see?
ASKER
thanks for your comments.
do you see any data? How many records do you see?for me all the data is loaded from the backend. in my case 17. But i have told it to display 5
do you have a test link...
because from the demo and documentation adding [mfRowsOnPage]="5" to the table should work... unless you have some strange JS errors or missing libraries...
because from the demo and documentation adding [mfRowsOnPage]="5" to the table should work... unless you have some strange JS errors or missing libraries...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I provided the solution to my problem!!
where is the code for this?