Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的网格的每一行都有一个用于保存模型的按钮,我需要一种方法来突出显示有待编辑的行。在不保存的情况下单击网格太容易了,并且完全忘记了未保存的编辑。一些用户可能也没有注意到保存按钮,并错误地认为他们的编辑在他们单击单元格时会立即保存。
这有效:
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()); }); } });