tbranyen/backbone.layoutmanager — Issue #23: layout manager loses event subscriptions?
Author: sontek
Created: 2011-12-28 22:10:05+00:00
State: open

I have a single view that is bound to a collection:

Permissions.Views.UserList = Backbone.LayoutManager.View.extend({
template: 'userlist',

events: {
'click': 'select'
},

initialize: function() {
this.collection.bind("all", function() {
this.render();
}, this);
},

serialize: function() {
return { users: this.collection.toJSON() };
},

select: function() {
console.log('select');
}
});

The 'select' function is never called because of the collection bind in intialize. If I comment out the initialize the select fires just fine.