I was wondering if there is a complete example that could demonstrate how can we use pagination with ember.js
I have a table that has many rows, so i want to use pagination to help the user with the data analysis.
I've already see the Ember.PaginationSupport.js
but i can't find a way to work with this in a html view.
I have had great success with https://github.com/notmessenger/emberjs-pageable but Ember now has something built in natively into ArrayController called
arrangedContent
that does this. You can also specify default sort orders on specific fields on your models. Ember.js and arrangedContent talks about it a little bit.You might want to check this npm module for a simple pagination implementation in Ember: Ember CLI Simple Pagination
The updated example below works with ember.js RC1 -- 03/14/2013
First you need to add a pagination like mixin as one doesn't yet exist in the ember core
Next you need to use the mixin above in your ArrayController like so
Next you can add a simple helper view to display the page numbers as li tags
Your routes might look something like this (nested page under the parent)
And finally, you need to add some html to display it
Here is a full working project with this in action if you want to see it work
https://github.com/toranb/ember-pagination-example
After some improvements and help of my friend edgar we came up with a very simple solution that you could check out in GitHub
basically we extended Ember.ArrayProxy in order to accomplish the pagination and also added actions to manage the previus and next pages.
Thanks to @Toran Billups for his solution and algo @Jeremy Brown