javascript - Strange behavior with "this" in Backbone.js when binding to "add"/"remove" in a collection -
i have following 2 views based on backbone.js pg.views.itemlist = backbone.view.extend({ tagname: "div", classname: "items", initialize: function() { _.bindall(this, 'addone', 'addselected') items.bind('add', this.addone); items.fetch(); }, // removed addone: function(item) { console.log($(this.el)); var view = new pg.views.item({model: item}); $(this.el).append(view.render().el); }, addselected: function(itemlist) { _.each(itemlist, this.addone); return this.el; }, // removed }); pg.views.section = backbone.view.extend({ tagname: "section", sectiontemplate: _.template($('#section-template').html()), events: { // removed }, initialize: function() { _.bindall(this, 'render', 'close', 'additemtosection', 'removeitemfromsection'); this.model.bind('change', this.render); this.model.view ...