Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Infinite Pagination actually remove previous items from collection #167

Closed
mogadanez opened this Issue · 20 comments

6 participants

@mogadanez

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

@addyosmani
Owner

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

@SBoudrias
Owner

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 })
@michaelmior

+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.

@michaelmior

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.

@SBoudrias
Owner

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

@lenniboy
Owner
@michaelmior

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.)

@michaelmior

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

@michaelmior

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?

@lenniboy
Owner
@michaelmior

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.

@lenniboy
Owner
@michaelmior

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

@lenniboy
Owner
@michaelmior

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.

@addyosmani
Owner

@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.

@michaelmior

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.

@lenniboy
Owner

Is this resolved? Can the ticket be closed?

@michaelmior

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

@simpixelated

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.