Closed frenic closed 9 years ago
Thank you for your question and sorry for the late response. Is this one fixes your case http://jsfiddle.net/f9uqrvo7/49/ ?
I revisited my code one more time and decided that :
-adapters should work only with attributes of Models. Now it accesses properties of Collections along with Model attributes. But in this case one should use a native adapters - .
So, in future version 2.1.0
expression :models
will return undefined
if called on Backbone.Collection
or any other non-Backbone.Model
object.
Example with future version of this adapter: http://jsfiddle.net/f9uqrvo7/51/
To work with a new version, please, use <div rv-each-list=".models">
or wrap collection with Backbone.Model:
rivets.bind(this.el, new Backbone.Model({
lists: lists
}));
and then use <div rv-each-list=":lists">
Thanks a lot, works like a charm!
Hi guys,
Thanks for a great work. But I'm having trouble making bindings work correctly with nested models when merging new data into the main collection using the fetch method.
I've simulated the behavior: http://jsfiddle.net/Faddee/f9uqrvo7/
In this case I'm using Backbone Associations, but I get the similar behavior using Backbone Relations.
The "Update" button sets the entire collection again but with model 3 replaced with model 4. This triggers the remove-event on model 3 and add-event on model 4, but nothing happens. Model 1 and 2 are intact and the change occurs correctly.
Same thing with the "Reset" button. The reset-event triggers but nothing happens.
But if i change:
to
It looks like it's working, but whats really happening is that everything rebinds (except for model 1 when you click the "Update" button for some reason).
Don't know if I'm doing something wrong or if this is an related issue to the adapter? Let me know if a can assist in any way!