Jquery 检查是否编辑了backgrid单元格
我只想检查是否有其他方法来检查单元格是否已编辑。现在这里是我的代码片段。这是一个自定义单元编辑器Jquery 检查是否编辑了backgrid单元格,jquery,backbone.js,editor,cell,backgrid,Jquery,Backbone.js,Editor,Cell,Backgrid,我只想检查是否有其他方法来检查单元格是否已编辑。现在这里是我的代码片段。这是一个自定义单元编辑器 Backgrid.CustomDateCell = Backgrid.DateCell.extend({ editor: Backgrid.InputCellEditor.extend({ attributes: { type: "text" }, events: {}, initialize: fu
Backgrid.CustomDateCell = Backgrid.DateCell.extend({
editor: Backgrid.InputCellEditor.extend({
attributes: {
type: "text"
},
events: {},
initialize: function(){
Backgrid.InputCellEditor.prototype.initialize.apply(this, arguments);
var _input = this;
$(this.el).prop('readonly', true);
$(this.el).datepicker({
autoclose: true,
todayHighlight: true,
format: "mm/dd/yyyy",
viewMode: "months",
minViewMode: "months"
});
$(this.el).on('hide', function(e){
var command = new Backgrid.Command({});
_input.model.set(_input.column.get("name"), e.date);
_input.model.trigger("backgrid:edited", _input.model, _input.column, command);
command = _input = null;
$(this).parent('td').addClass('cell-edited');
});
}
})
});
我选择当前datetimepicker的父td并添加新类的最后一部分不起作用。当我试图找到一个解决方案来实现这一点时,我只想知道backgrid是否已经有了更好的方法来检查单元格是否已被编辑
提前感谢我通过在自定义单元格的初始化中添加一个侦听器,使我的代码以某种方式工作
this.listenTo(_input.model, "backgrid:edited", function(){
$(this.el).parent().parent().addClass('cell-edited');
});
我仍然对我最初的要求持开放态度
谢谢