daniel-nagy / md-data-table

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

Change current page if it is greater than total. #285

Closed antoinebrault closed 8 years ago

antoinebrault commented 8 years ago

On client side filtering, page must change automatically when total is updated.

daniel-nagy commented 8 years ago

I think we should select the nearest page, which would be the last, not the first. What do you think?

$scope.$watch('$pagination.total', function (newValue, oldValue) {
  if(newValue === oldValue) {
    return;
  }

  if(self.page > self.pages()) {
    self.last();
  }
});
daniel-nagy commented 8 years ago

Okay, this should be fixed in v0.10.1.