Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Add ability to override base Backbone.Collection #120

Merged
merged 1 commit into from
Oct 24, 2013
Merged

Add ability to override base Backbone.Collection #120

merged 1 commit into from
Oct 24, 2013

Conversation

tgriesser
Copy link
Contributor

Currently, if you attempt to set Backbone.Collection to PageableCollection it triggers an infinite loop, because of how Backbone.Collection is referenced in the constructor. This properly references the Collection constructor to prevent this.

Currently, if you attempt to set Backbone.Collection
to PageableCollection it triggers an infinite loop,
because of how Backbone.Collection is referenced in the
constructor. This properly references the Collection
constructor to prevent this.
@wyuenho
Copy link
Member

wyuenho commented Oct 24, 2013

Thank you!

wyuenho added a commit that referenced this pull request Oct 24, 2013
Add ability to override base Backbone.Collection
@wyuenho wyuenho merged commit e1f7b88 into backbone-paginator:master Oct 24, 2013
@tgriesser
Copy link
Contributor Author

@wyuenho I was going to submit a separate PR but it might be easier for you to go through and fix throughout your projects:

Anywhere there's a _.template it assumes that a _.templateSettings.variable hasn't already been specified... which breaks the templates if it has been set.

Can you go through and explicitly set it to null when compiling:

_.template("<tag>Html <%- data %> here</tag>", null, {variable: null});

This is what i've had to do in things like the pageable helper to get them to work in my project.

@wyuenho
Copy link
Member

wyuenho commented Oct 24, 2013

@tgriesser Done on all 4 of the places. Thanks for heads up!

@tgriesser
Copy link
Contributor Author

Sure... one more question for you.

So when implementing a pageable collection, if you bootstrap a collection with a whole bunch of models, and then limit them to a certain amount (say 15)... it looks like when you try to collection.get on the id of a model that should be in the collection, but isn't in the current page, it's undefined. Or if you do collection.pluck('id'), it only shows you the id's for the items in the current page. Is this expected behavior?

I was looking to see where this was happening but I was having a hard time following.

@wyuenho
Copy link
Member

wyuenho commented Oct 24, 2013

If the collection is under client or infinite mode, you get grab the model from collection.fullCollection.get. Word of advice: don't try following the code, it's so magical I can't even follow it without looking at the tests. Read the readme :)

Sent from my iPhone

On 24 Oct, 2013, at 11:59 pm, Tim Griesser notifications@github.com wrote:

Sure... one more question for you.

So when implementing a pageable collection, if you bootstrap a collection with a whole bunch of models, and then limit them to a certain amount (say 15)... it looks like when you try to collection.get on the id of a model that should be in the collection, but isn't in the current page, it's undefined. Or if you do collection.pluck('id'), it only shows you the id's for the items in the current page. Is this expected behavior?

I was looking to see where this was happening but I was having a hard time following.


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants