I have a view that derives from the collection:
render: function() { $(this.el).html(JST['templates/menu']({collection: this.collection })); $('#nav').html(this.el); }
In the view initializer, I bind the add collection event to the view rendering function:
initialize: function() { this.render(); var self = this; this.collection.bind("add", function(event){ self.render(); }); }
elsewhere in the application, I am adding an item to the collection.
bookSubscription_collection.add(model);
The problem with this code is that if I add a new item to the collection, then all the elements in the collection will be re-rendered.
Is there a way to add a new item to the collection without reprocessing all the other items, but just visualize the new item?
Jonathan aubuchon
source share