Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Infinite Pagination actually remove previous items from collection #167

Closed
mogadanez opened this Issue Mar 28, 2013 · 20 comments

Comments

Projects
None yet
6 participants

Infinite Pagination Sample is actually hacky.

On always append items, but actually collection contains only last page requested.

So in useful only for reporting applications. In other case it is introduce mess because view does not correspond to model

Owner

addyosmani commented Apr 1, 2013

Thanks for reporting this. We hadn't noticed it before but it appears you're right. We'll aim to fix this.

Owner

SBoudrias commented Apr 9, 2013

Hey @mogadanez, if you need a fix right now, you can already do it this way to force the infinite behavior:

collection.requestNextPage({ update: true, remove: false })
Contributor

michaelmior commented Apr 10, 2013

+1 Seeing this same issue here. @SBoudrias Curious why you added update: true? I don't imagine it would cause any issues, but I don't think updates should be required. Perhaps I'm missing something.

Contributor

michaelmior commented Apr 10, 2013

As far as fixing this, I assume this is related to the new behaviour of fetch in Backbone 1.0. I think the correct solution may be to set the options suggested by @SBoudrias as defaults in Paginator.requestPager.pager.

Owner

SBoudrias commented Apr 10, 2013

@michaelmior You're right, update: true ain't necessary in this case. I just copy/paste a fix I had some time ago.

If someone wants to put together a pull request fixing the demo we're happy
to merge it in.

On Wednesday, April 10, 2013, Simon Boudrias wrote:

@michaelmior https://github.com/michaelmior You're right, update: trueain't necessary in this case. I just copy/paste a fix I had some time ago.


Reply to this email directly or view it on GitHubhttps://github.com/addyosmani/backbone.paginator/issues/167#issuecomment-16202278
.

Contributor

michaelmior commented Apr 11, 2013

Will do. Unfortunately I see the Netflix API used is no longer available as of April 8th, so another source of data will also be needed. (This also applies to the client and request paging examples.)

Contributor

michaelmior commented Apr 11, 2013

How do you feel about switching to the Twitter search API for the demos which currently use Netflix? Should be fairly easy to implement.

Contributor

michaelmior commented Apr 11, 2013

Actually, new Twitter APIs also require authentication and the old ones will eventually disappear. Any other suggestions on open data sources to use would be appreciated :)

It seems that most APIs are switching to keeping track of the last ID of the previous request for paging. While this is certainly possible, I feel it complicates a demo. Maybe worthwhile those since that seems the direction many are going. Thoughts?

Whilst it isn't as visual and pop culture friendly, the Github API is
really well done and supports paging and jsonp.

An example could be getting the list commits to a popular repo, like so:
https://api.github.com/repos/jquery/jquery/commits

On 11 April 2013 14:36, Michael Mior notifications@github.com wrote:

Actually, new Twitter APIs also require authentication and the old ones
will eventually disappear. Any other suggestions on open data sources to
use would be appreciated :)

It seems that most APIs are switching to keeping track of the last ID of
the previous request for paging. While this is certainly possible, I feel
it complicates a demo. Maybe worthwhile those since that seems the
direction many are going. Thoughts?


Reply to this email directly or view it on GitHubhttps://github.com/addyosmani/backbone.paginator/issues/167#issuecomment-16231642
.

Contributor

michaelmior commented Apr 11, 2013

For commits, pagination doesn't use page numbers, but I think issues would work. The API suggests not constructing page URLs manually, but I think it's good enough for a demo. I'll try to tackle this tonight.

I think the events api might even be nicer since it contains stuff like
"user X has forked repo Y" but also reported issues.

On 11 April 2013 17:57, Michael Mior notifications@github.com wrote:

For commits, pagination doesn't use page numbers, but I think issues would
work. The API suggests not constructing page URLs manually, but I think
it's good enough for a demo. I'll try to tackle this tonight.


Reply to this email directly or view it on GitHubhttps://github.com/addyosmani/backbone.paginator/issues/167#issuecomment-16243667
.

Contributor

michaelmior commented Apr 11, 2013

@lenniboy That seems like it would complicate the template in terms of handling different event types.

That seems like a good point. If you can get the examples going again I'd
be quite greatful.

On Thursday, April 11, 2013, Michael Mior wrote:

@lenniboy https://github.com/lenniboy That seems like it would
complicate the template in terms of handling different event types.


Reply to this email directly or view it on GitHubhttps://github.com/addyosmani/backbone.paginator/issues/167#issuecomment-16246445
.

Contributor

michaelmior commented Apr 12, 2013

I have a basic version of the examples working with the GH Issues API. However, for some reason infinite scrolling seems to work correctly in the demo, so needs some investigating.

Owner

addyosmani commented May 18, 2013

@michaelmior thanks for your initial work on this. It's massively appreciated. Given the work you're doing to update the API used for demos would you be up for owning #171? We'd of course be happy to credit you in the readme.

Contributor

michaelmior commented May 19, 2013

Sure. I should have some time to check into this tomorrow. Can't recall where I left this at, but shouldn't be too much left to clean up the existing demos.

Is this resolved? Can the ticket be closed?

Contributor

michaelmior commented Jun 13, 2013

@lenniboy I didn't touch this when updating the examples, so I believe this is still valid.

FYI passing { remove: false} only works if you're using Backbone 1.0.0. With older versions, it still replaces the collection on every fetch. See example here: http://jsfiddle.net/simpixelated/nTkJf/6/

@addyosmani addyosmani closed this May 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment