mharris717 / ember-cli-pagination

Pagination Addon for Ember CLI
MIT License
273 stars 116 forks source link

no currentPage, totalPage + no int for totalPages, currentPage #142

Open clawfire opened 9 years ago

clawfire commented 9 years ago

Upgraded to Ember Data 1.13.8 ( w/ Ember 1.13.7 ) and my pagination is broken now

validate.js:12 no currentPage for page-numbers
validate.js:12 no totalPages for page-numbers
validate.js:12 no int for currentPage val is undefined
validate.js:12 no int for totalPages val is undefined
validate.js:12 no int for currentPage val is NaN
validate.js:12 no int for totalPages val is NaN

my controller

import Ember from 'ember';

export default Ember.ArrayController.extend({
  cars: Ember.computed.alias('model'),
  // setup our query params
  queryParams: ["page"],

  // binding the property on the paged array
  // to the query params on the controller
  pageBinding: "content.page",
  perPageBinding: "content.perPage",
  totalPagesBinding: "content.totalPages",

  // set default values, can cause problems if left out
  // if value matches default, it won't display in the URL
  page: 1,
  perPage: 25
});

my route

import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
import RouteMixin from 'ember-cli-pagination/remote/route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, RouteMixin,{
  model: function(params){
    params.paramMapping = {page: "page",
                           perPage: "page_size",
                           total_pages: "page_count"};
    return this.findPaged('car', params);
  }
});
broerse commented 9 years ago

Update to Ember 1.13.8 will help. There are some strange bugs with 1.13.7

ghedamat commented 9 years ago

@clawfire confirm 1.13.8 fixes the issue

clawfire commented 9 years ago

Updated to Ember 1.13.8 and I now have a decent rendering ( visually I mean, no more broken layout )

capture d ecran 2015-09-11 a 11 24 15

But still can't get the good amount of pages :/

no totalPages for page-numbers
no int for totalPages val is undefined
no int for totalPages val is NaN
clawfire commented 9 years ago

Just found this : no total_pages in meta response just like it doesn't use the association I made in the route :/

anmolagrwl commented 8 years ago

confirm 1.13.8 fixes the issue

ionmx commented 8 years ago

Thanks, I'm using Ember 1.3.10 and Ember Data 1.3.8 and it works fine.