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


#21

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

http://emberjs.com/api/classes/Ember.ArrayProxy.html#property_arrangedContent

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


#22

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.


#23

@robdel12 let me know if I can help


#24

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.


#25

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.


#26

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


#27

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.


#28

Thanks, I will take a look!!


#29

FYI, Addon has improved a ton since original posting


#30

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


#31

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?


#32

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

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

#33

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


#34

Demo + Pagination: http://exmer.com/bloggrcouch/


#35

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.


#36

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


#37

I am looking forward to it.


#38

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


#39

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


#40

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