0

Each row of my grid has a button for saving the model, and I need a way to highlight rows with pending edits. It's too easy to click around the grid without saving, and totally lose track of unsaved edits. Some users might also not notice the save button, and mistakenly think their edits save as soon as they click out of a cell.

Dave
  • 489
  • 1
  • 3
  • 13

1 Answers1

0

This worked:

var MyRow = Backgrid.Row.extend({
    initialize: function() { 
        MyRow.__super__.initialize.apply(this, arguments);
        this.listenTo(this.model, 'change', function (model) {
            this.$el.toggleClass('dirty', model.hasChanged());
        });        
    }
});
Dave
  • 489
  • 1
  • 3
  • 13