Skip to content

Instantly share code, notes, and snippets.

@matheusdavidson
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matheusdavidson/82e922b4c0e0c9b5fa66 to your computer and use it in GitHub Desktop.
Save matheusdavidson/82e922b4c0e0c9b5fa66 to your computer and use it in GitHub Desktop.
Controller
import Ember from 'ember';
import Mixin from './../../mixins/pagination';
export
default Ember.ArrayController.extend(Mixin, {
// setup our query params
queryParams: ["page", "perPage", "filter", "order"],
// setup orders
selOrders: [{
label: 'Recente',
value: 'created_at-asc'
}, {
label: 'Nome (A-Z)',
value: 'c_name-asc'
}, {
label: 'Nome (Z-A)',
value: 'c_name-desc'
}],
// binding the property on the paged array
// to the query params on the controller
pageBinding: "content.page",
perPageBinding: "content.perPage",
totalPagesBinding: "content.totalPages",
// optional. Don't serialize default values
// into the URL
page: 1,
perPage: 15,
filter: '',
order: 'c_name-asc',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment