[bug]click another elements hidden datepicker will hidden also
<div class="alert alert-success">
<div class="close">X</div>
somenotify
</div>
<div id="datepicker"></div>
<script type="text/javascript">
$('#datepicker').datepicker({
format: "yyyy/mm/dd",
weekStart: 0,
//language: "zh-CN",
todayHighlight: true
});
</script>
if i click X to hidden alert,.date time will hidden...i dont konw why will cause this,i use it in Embedded / inline model i found here was a bug,i think it should determined did this works inline:
[$(document), {
mousedown: $.proxy(function(e){
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length
)){
//$(this.picker).hide();
}
}, this)
mousedown: $.proxy(function(e){
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length ||
this.element.attr('data-module') != 'inline'
)){
$(this.picker).hide();
}
i redit like this, and if i want make it inline,will add attributes data-module=“inline”
wish fix it in next update
+1 Joebnb I've hit this bug also I'll clarify this here to make sure it's the same issue joebnb mentions above.
When the datepicker is being used in inline/embedded mode, it's hidden whenever another mousedown is called on another element on the page.
at first look Joe's fix seems to work.
May I know why the example didn't hit the bug? the inline mode of datepicker is not hidden up.
http://eternicode.github.io/bootstrap-datepicker/?markup=embedded&format=&weekStart=&startDate=&endDate=&startView=0&minViewMode=0&todayBtn=false&clearBtn=false&language=en&orientation=auto&multidate=&multidateSeparator=&keyboardNavigation=on&forceParse=on#sandbox
Fixed, code should be like this
mousedown: $.proxy(function(e){
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length ||
this.isInline == true
)){
$(this.picker).hide();
}
}, this)
@alvin0618 this bug appears in 1.4.1-dev, the example page has 1.4.1 stable.
I'm not sure what introduced this funny bug, should we create a pull request for it?
Yes please, if you have a fix create a PR for it. So the we can review it and check if the original problem (what was fixed in the currently broken code) is still fixed
@razvanphp i downloaded the 1.5.0dev version, the problem is still there.