【发布时间】:2015-05-07 09:58:10
【问题描述】:
我已经搜索了网络,但我找不到任何解决这个问题的方法。这是我的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",
onClose: function(dateText, inst){
var command = new Backgrid.Command({});
_input.model.set(_input.column.get("name"), dateText);
_input.model.trigger("backgrid:edited", _input.model, _input.column, command);
command = _input = null;
}
});
}
})
});
所以基本上,我想要的是触发 backgrid:edited 的 backgrid 单元模型。但似乎我在这里遗漏了一些东西。永远不会调用 onClose 事件,并且控制台中不会显示任何错误。我也尝试了 onSelect 事件,但结果相同。
提前致谢
【问题讨论】:
-
这是什么日期选择器?
viewMode和autoclose看起来像引导选项,但onClose是一个 jqueryui 选项 -
它是一个引导日期选择器。我忽略了这一点。感谢您的提醒。
标签: javascript jquery backbone.js underscore.js backgrid