【发布时间】:2015-05-08 03:15:41
【问题描述】:
我只想检查是否有其他方法可以检查单元格是否已被编辑。目前这里是我的代码 sn-p。这是一个自定义单元格编辑器。
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');
});
}
})
});
我选择当前日期时间选择器的父 td 操作并添加新类的最后一部分不起作用。虽然我正在尝试找到解决方案来使其正常工作,但我只想知道 backgrid 是否已经有更好的方法来检查单元格是否已被编辑。
提前致谢
【问题讨论】:
标签: jquery backbone.js editor cell backgrid