I am working on a Backbone Project with Backbone.Layoutmanager.js
Ive got a ListView with nested ReceiverViews.
My collection is updated unordered - i want to sort these views BUT i dont want to re-render the whole collection. ( because i loose old data / event handler / graph instance inside old views. )
How to fix ?
ReceiverListView = Backbone.View.extend({
manage:true,
initialize: function(options){
_.bindAll(this, "renderReceiver","renderMe");
this.vent = _.extend({}, Backbone.Events);
this.collection.on('add', this.renderMe, this);
},
renderMe: function(model1){
this.collection.sort(this.collection.comparator);
this.insertView(new ReceiverView({model: model1})).render();
}
You don't need to call sort method manually. Learn about it: http://backbonejs.org/#Collection-sort
Hope this helps