Skip to content Skip to sidebar Skip to footer

Backbone Js Template Printing Only Last Item In The Collection

I am facing a problem with my backbone view. I am trying to render an array of day objects and each day object contains another array of time objects. I get the collection from my

Solution 1:

When fetching data in a collection, Backbone will perform a collection.set with the data:

set collection.set(models, [options]) The set method performs a "smart" update of the collection with the passed list of models. If a model in the list isn't yet in the collection it will be added; if the model is already in the collection its attributes will be merged; and if the collection contains any models that aren't present in the list, they'll be removed.

All your models have the same id, 0, which seems to hopelessly confuse Backbone : see this demo http://jsfiddle.net/T3fmx/

To solve your quandary, you can either:

Post a Comment for "Backbone Js Template Printing Only Last Item In The Collection"