【发布时间】:2011-02-10 23:53:30
【问题描述】:
我正在使用 Jeditable 和 datepicker 进行内联编辑。我的表中有一个列,它将日期显示为超链接。当我单击它时,它会显示日期选择器。 And when a particular date is selected its updated in the backend and the cell now is updated with the changed value.但是,在更改月份或年份时遇到 onblur 事件问题。当我单击日期选择器控件上的“上一个”或“下一个”按钮时,会触发此事件。这会在选择日期时导致异常。只要所选日期在当前月份,此方法就可以正常工作。我尝试了此处列出的所有可能的解决方案:
stackoverflow.com/questions/2007205/jeditable-datepicker-causing-blur-when-changeing-month
如果 settimeout 控件在关闭日期选择器或真正的 onblur 事件时不会变回正常的超链接。
这是我的代码,
$.editable.addInputType('datepicker', { 元素:功能(设置,原始){ var 输入 = $(''); if (settings.width != 'none') { input.width(settings.width); } if (settings.height != 'none') { input.height(settings.height); } input.attr('自动完成','off'); $(this).append(input); 返回(输入); }, 插件:功能(设置,原始){ var form = this;
settings.onblur = function(e) {
t = setTimeout(function() {
original.reset.apply(form, [settings, self]);
}, 100);
};
$(this).find('input').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-M-y',
closeAtTop: true,
onSelect: function(dateText) { $(this).hide(); $(form).trigger('submit'); }
});
},
submit : function(settings, original) { }
});
$(函数() { $('.edit_eta').editable('update_must_fix_eta.php', { id: 'bugid', 名称:'eta', 类型:“日期选择器”, 事件:“点击”, 选择:真, 宽度:'50px', onblur:'取消', cssclass : '可编辑', indicator : '正在更新 ETA,请稍候。', 风格:'继承', 提交数据:{版本:'4.2(4)',标签:'REL_4_2_4',qstr:1} }); });
我尝试破解 jeditable.js,如以下链接所述:http://groups.google.com/group/jquery-dev/browse_thread/thread/265340ea692a2f47
即使这样也无济于事。
感谢任何帮助。
【问题讨论】:
标签: datepicker jeditable onblur