How to implement delete per row for backgrid

…衆ロ難τιáo~ 提交于 2019-12-03 00:44:58

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:

  1. this.el - This is a direct reference to the DOM element.
  2. 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;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!