daniel-nagy / md-data-table

Material Design Data Table for Angular Material
MIT License
1.9k stars 519 forks source link

Incorrect values for search with pagination client side #544

Closed tejasrivastav closed 7 years ago

tejasrivastav commented 7 years ago

http://codepen.io/anon/pen/LxOKZd?editors=1010,

Enable search with client side pagination. The pagination values are incorrect.

ielektronick commented 7 years ago

Pagination values ARE correct, because you assign filteredDesserts to desserts.data. This works: ... ng-repeat="dessert in (filteredDesserts = (desserts.data | filter: search) | orderBy: query.order | limitTo: query.limit : (query.page -1) * query.limit)" ... So, you need to filter desserts and after that order and limit.

tejasrivastav commented 7 years ago

Even in that case the resultant array has only 5 values.

http://codepen.io/anon/pen/LxOKZd?editors=1010

ielektronick commented 7 years ago

Sorry, but I don't see any changes in your codepen. Did you update it with recommended ones?

tejasrivastav commented 7 years ago

sorry, updated link http://codepen.io/anon/pen/RpJwqd?editors=1010

ielektronick commented 7 years ago

You need to put a bracket not at the end, but after filter:search. Take a look at recommended changes in my comment. :)

ielektronick commented 7 years ago

Like that: (filteredDesserts = (desserts.data | filter: search) | orderBy: query.order ...)

tejasrivastav commented 7 years ago

My bad. Noob Me. Thanks a ton. :)