Open sbharadwaj92 opened 9 years ago
Is this after filtering? Or an actual change in the data?
How to do it after filtering?
I think you could watch
on the data you want to check and then change the page back to 1.
Like this. Whenever I do filtering, I'll reset the page to 1.
$scope.$watch('query.filter', function(val) {
$scope.query.page = 1;
});
You can change the page within your controller and it should update the table.
I just released a big update with lots of changes and new features, check it out!
On Dec 27, 2015, at 10:59 PM, Tu Chu Quang notifications@github.com wrote:
I think you could watch on the data and then change the page back to 1.
Like this. Whenever I do filtering, I'll reset the page to 1.
$scope.$watch('query.filter', function(val) { $scope.query.page = 1; }); — Reply to this email directly or view it on GitHub https://github.com/daniel-nagy/md-data-table/issues/176#issuecomment-167477284.
WOW. What an update. Thanks a lot @daniel-nagy
Made a pull request (https://github.com/daniel-nagy/md-data-table/pull/285) to reset the page to 1 if current page index > total
I have had the same problem that i resolved by using a filtered parameter and setting page to 1 whenever a filter changed
<md-table-pagination md-total="{{filtered.length}}" ...></md-table-pagination>
...
<tr md-row ng-repeat="item in filtered = (items | filter: myFilters)">
...
</tr>
I want to reset the pagination after there is a change with the total number of rows