jeditable datepicker causing blur when changing month
I'm using a jquery-ui datepicker inside of jeditable. Changing the month causes a blur. In order to be able to keep functioning after the blur, I had to set settings.onblur="cancel"
But I need it to "cancel" in the case of an actual blur.
Has anyone run into this issue?
edit:
i just hacked jeditable with:
monthChangeButtonClicked = function(blurEvent) {
return blurEvent.originalEvent.explicitOriginalTarget.innerHTML == "Prev" ||
blurEvent.originalEvent.explicitOriginalTarget.innerHTML == "Next"; }
if (monthChangeButtonClicked(e)) return;
Such a nasty hack :开发者_Python百科(I also ran into this same issue when changing the month.
I tweeked the code that sets up the custom input type, to handle the onblur event there. This seems to work:
jQuery.editable.addInputType('datepicker', {
element: function(settings, original) {
var input = jQuery('<input size=8 />');
// Catch the blur event on month change
settings.onblur = function(e) {
t = setTimeout(function() {
reset.apply(form, [settings, self]);
}, 500);
};
input.datepicker({
dateFormat: 'yy-mm-dd',
onSelect: function(dateText, inst) {
jQuery(this).parents("form").submit();
},
onClose: function(dateText, inst) {
jQuery(this).parents("form").submit();
},
});
input.datepicker('option', 'showAnim', 'slide');
jQuery(this).append(input);
return (input);
}
});
The jeditable-datepicker plugin seems to do exactly what you need.
It enables jQuery UI Datepicker in Jeditable. Here's the demo.
精彩评论