ember-cli-pagination icon indicating copy to clipboard operation
ember-cli-pagination copied to clipboard

Remote Paginated API scenario: refreshModel is needed?

Open lnmunhoz opened this issue 10 years ago • 3 comments

I lost two days trying to understand why my model does not get updated when I click on the next page button. So, in the query-params documentation I found that when you need a full transition (another request from the server) to get the pagination done, you have to tell the route that when this queryParam had changed, make another request to update your model.

The controller:

MyModelController = Ember.ArrayController.extend
  queryParams: ['page', 'perPage']

The route:

MyModelRoute = Ember.Route.extend RouteMixin,
  queryParams:
    page:
      refreshModel: true

This is what a Remote Pagination is, right? Everytime you call a new page, you request to the server this page data.

However, I will create a PR to put this on docs, because it was really painful to me. (I'm a emberjs noob by the way)

Thanks :)

lnmunhoz avatar Apr 26 '15 23:04 lnmunhoz

This is a good catch lnmunhoz! I had a similar problem while attempting to decorate a model from inside my route where transitions would not trigger the expected hooks.

gte451f avatar Jun 04 '15 23:06 gte451f

Yes, It's very confusing and this config is essential to the pagination works.

lnmunhoz avatar Jun 05 '15 22:06 lnmunhoz

I am encountering a similar issue, but the fix you have suggested doesn't refresh anything for me. When I press the next page arrow, the next items are correctly being added to my store, however, the page never changes. Any ideas?

lukeclewlow avatar Jul 08 '15 15:07 lukeclewlow