Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Datepicker onClose事件用作后台网格编辑器时未触发_Javascript_Jquery_Backbone.js_Underscore.js_Backgrid - Fatal编程技术网

Javascript Datepicker onClose事件用作后台网格编辑器时未触发

Javascript Datepicker onClose事件用作后台网格编辑器时未触发,javascript,jquery,backbone.js,underscore.js,backgrid,Javascript,Jquery,Backbone.js,Underscore.js,Backgrid,我在网上搜索了一下,找不到任何关于这个问题的线索。这是我的片段 Backgrid.CustomDateCell = Backgrid.DateCell.extend({ editor: Backgrid.InputCellEditor.extend({ attributes: { type: "text" }, events: {}, initialize: function(){

我在网上搜索了一下,找不到任何关于这个问题的线索。这是我的片段

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:backgrid单元模型的编辑。但我似乎错过了一些东西。永远不会调用onClose事件,并且控制台中不会显示任何错误。我也尝试了onSelect事件,但结果相同


提前感谢

如评论中所述:

这是一个引导数据采集器,因此
onClose
不是有效的选项。将侦听器附加到
hide
事件:

        $(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;
            });

e.date
应该为您提供相当于
dateText

这是什么日期选择器
viewMode
autoclose
看起来像引导选项,但是
onClose
是一个jqueryui选项,它是一个引导日期选择器。我忽略了这个。谢谢你的提醒。非常感谢你的帮助。现在触发了。所选日期仍然存在问题,因为它始终显示1970年1月。