New Addon: Ember CLI Pagination - Looking to help people get setup

I was also thinking about what I was trying to say :wink: and found this:

I think you can perhaps add pagination via an Array proxy without changing the array data.

At first I tried an ArrayProxy and a “wrapping future,” but I couldn’t get it to work right. A PagedArray is quite possibly the right way to go in the future.

Was thinking, could perhaps have two “modes,” one for when you’re requesting each page from server, and one where all the data is already assumed loaded. The mode would be a config setting. Might try a spike today.

@robdel12 let me know if I can help

Hi I just found http://resistor.io/blog/2013/10/01/simple-pagination-in-ember-arraycontrollers/ and it uses arrangedContent. Perhaps it helps you to add the dual mode.

Interesting error here.

Uncaught Error: No model was found for 'todo'

I don’t have anything that has todo in it

Edit: I opened an issue on github.

@robdel12 thanks for catching my stupid. Fixed in 0.2.2.

Pushed 0.2.2.

Now has support for local pagination, where all the records are already loaded client-side.

Changed the way to include the mixins in your route and controller, although the old way will still work if you’re doing remote pagination. Readme should explain it.

https://github.com/mharris717/ember-cli-pagination

Thanks, I will take a look!!

FYI, Addon has improved a ton since original posting

Hi, I could not find the time but will try it tomorrow.

It work super!!! but it seems the sortProperties are lost.

https://github.com/broerse/ember-cli-blog/blob/pagination/app/controllers/posts.js

Is it binding on the unsorted content?

You’ll want to page the arrangedContent array if you are sorting

pagedArray('arrangedContent', {perPage: 5})

I did’t know this. Learning more and more Ember every day. Thanks!

Demo + Pagination: Myapp

Now there are more items in the demo it would be nice if you can set the max number op pageselectors to 10 and get:

« 39 40 41 42 43 44 45 46 »

(or is this 8?)

The same way as Google Search.The selected page is moved to a center position ( 5 from the back) on Google if you select one.

Agreed, this is one of my biggest todos. I’ll bump it up the list.

I am looking forward to it.

The perPage seems to add-up if you use queryParams?

import Ember from "ember";
import pagedArray from 'ember-cli-pagination/computed/paged-array';

export default Ember.ArrayController.extend({
  sortProperties: ['date'],
  sortAscending: false,
  
  queryParams: ["page", "perPage"],
  
  pagedContent: pagedArray('arrangedContent', {perPage: 5}),
  
  pageBinding: "pagedContent.page",
  perPageBinding: "pagedContent.perPage",
  totalPagesBinding: "pagedContent.totalPages"
});

Should it not be set this way?

Also, but not big on my wishlist, if we have URL’s per page perhaps add rel=“prev” & rel=“next”. See:

Looking at this video got me thinking you can also add a “All Page” button that expands perPage to ∞. Perhaps if perPage=0

Interesting, letting my brain chew on it for a bit.

Made good progress on truncating page display.

Issue for truncating page display: https://github.com/mharris717/ember-cli-pagination/issues/11

@broerse Can you clarify what you mean by “add-up”?