I\'ve been trying to implement a \"delete\" button for backgrid rows. A solution seems to be described here:
How to add a custom delete option for backgrid rows
You are getting an exception because your trying to call the function on the wrong view property. Backbone views have two different ways to access it's el, either directly in the DOM or as a jQuery object as follows:
this.el
- This is a direct reference to the DOM element.this.$el
- The jQuery object for the DOM element.Its important to remember, that you need to call functions like append()
and html()
on the $el
property as they are jQuery functions.
dcarson is correct of course but just to very plainly spell out the code for the render function that I was able to use to get this to work correctly, with this.$el substitued for this.el:
render: function () {
this.$el.html(this.template());
this.delegateEvents();
return this;
}