How to add a custom delete option for backgrid rows

前端 未结 1 1593
孤城傲影
孤城傲影 2021-02-08 02:28

i have developed editable grid using backgrid and it looks good also. following is my output :

when i select the check box and click on delete icon, then

相关标签:
1条回答
  • 2021-02-08 02:45

    You can make a custom cell.

    var DeleteCell = Backgrid.Cell.extend({
        template: _.template(" PUT YOUR HTML BUTTON TEMPLATE HERE "),
        events: {
          "click": "deleteRow"
        },
        deleteRow: function (e) {
          e.preventDefault();
          this.model.collection.remove(this.model);
        },
        render: function () {
          this.$el.html(this.template());
          this.delegateEvents();
          return this;
        }
    });
    
    0 讨论(0)
提交回复
热议问题