Bootstrap Datepicker切换禁用 [英] Bootstrap datepicker toggle disable
问题描述
我正在使用bootstrap-datepicker并遇到问题.
I am using bootstrap-datepicker and getting an issue.
当我单击一天时,效果很好,但是当我再次单击同一天时.选择被取消
When I click a day, it works well,but when I click the same day again. The selection gets cancelled
我从上面的链接中找到了引导日期选择器的示例.
I had found the example for bootstrap date picker from the above link.
推荐答案
这是一个已知问题.这是解决此问题的方法.
It's a known issue. Here is a workaround for this issue.
https://github.com/eternicode/bootstrap-datepicker/issues/816
jsfiddle问题: http://jsfiddle.net/antonkruger/fpgseobz/
jsfiddle the issue: http://jsfiddle.net/antonkruger/fpgseobz/
一旦尝试过,我将发布更新.
Once I've tried it, I'll post an update.
更新: 是的,它有效.
在默认值@ 1394行中,添加一个新选项allowDeselection
In the defaults @ line 1394, add a new option, allowDeselection
var defaults = $.fn.datepicker.defaults = {
allowDeselection: false,
...
};
在_toggle_multidate函数@第1015行中,将"else if(ix!== -1)"语句修改为:
In the _toggle_multidate function @ line 1015, modify the "else if (ix !== -1)" statement to:
else if (ix !== -1 && this.o.allowDeselection){
this.dates.remove(ix);
}
这篇关于Bootstrap Datepicker切换禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!