Closed tgriesser closed 10 years ago
Thank you!
@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.
@tgriesser Done on all 4 of the places. Thanks for heads up!
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.
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.
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.