jQuery Datepicker: Prevent closing picker when clicking a date

后端 未结 9 2222
南方客
南方客 2020-11-29 08:16

Hi fellow stackoverflow:ers,

I\'m using the jQuery Datepicker plugin, together with Martin Milesich Timepicker plugin. Everything works great, except for the fact th

9条回答
  •  忘掉有多难
    2020-11-29 09:16

    Following with what Emil suggested, I found a nicer and easier way to modify the widget to support a not closing widget on select event.

    First, I added another property to the defaults dict on the widget:

    closeOnSelect:true //True to close the widget when you select a date
    

    Second, find this statement in the _selectDate method:

    if (inst.inline)
            this._updateDatepicker(inst);
    else {
            ...
        }
    

    And change the condition to be like this:

    var closeOnSelect = this._get(inst, "closeOnSelect");        
    if (inst.inline || !closeOnSelect)
            this._updateDatepicker(inst);
    else {
            ...
        }
    

    Give it a try, it is working for me. I did it over the JQuery UI 1.8.5 version.

提交回复
热议问题