问题描述
我需要点击在页面上编辑元素,这将反过来调用jQuery UI Datepicker的实例。
I need to have a click to edit element on a page, that will in turn invoke an instance of the jQuery UI Datepicker.
目前,我使用JEditable来提供就地编辑,这是工作正常。但是,我有一个日期控件输入,我想显示为一个日历,这是有趣的开始。
Currently, I'm using JEditable to provide the in place editing, which is working fine. However, I have a date control input that I would like to have appear as a calendar, which is where the fun starts.
我发现了一个注释由Calle Kabo(该页面有点捣碎不幸),详细信息方法是:
I've found a Comment in the this blog by Calle Kabo (the page is a little mashed unfortunately) that details a way to do this:
$.editable.addInputType("datepicker", {
element: function(settings, original) {
var input = $("<input type=\"text\" name=\"value\" />");
$(this).append(input);
return(input);
},
plugin: function(settings, original) {
var form = this;
$("input", this).filter(":text").datepicker({
onSelect: function(dateText) { $(this).hide(); $(form).trigger("submit"); }
});
}
});
但是,我无法使上述工作 - 没有错误,我试过把它放在jQuery文档准备函数中,也在它外面 - 没有快乐。
However, I can't get the above to work - no errors, but no effect either. I've tried placing it within the jQuery document ready function and also outside of it - no joy.
我的UI Datepicker类是日期选择器,我的Jeditable类是ajaxedit ,我敢肯定以上不作为是由于需要在代码中以某种方式引用它们,但我不知道如何。此外,Jeditable控件是许多元素id之一,如果它有一个方位。
My UI Datepicker class is date-picker and my Jeditable class is ajaxedit, I'm sure the above inaction is due to the need to reference them somehow in the code, but I don't know how. Also, the Jeditable control is one of many element ids, if that has a bearing.
在知道更多的任何想法?
Any ideas from those more in the know?
推荐答案
我有同样的问题。在带给我解决方案。
I had the same problem. Searching inside the sourcecode of http://www.appelsiini.net/projects/jeditable/custom.html brought me to the solution.
有一个jquery.jeditable.datepicker.js。在我的代码中添加了一个新函数datepicker(也在源代码中)。
There is a "jquery.jeditable.datepicker.js". Putted this in my code an added a new function "datepicker" (also in the source).
我不知道你的脚本如何工作,还需要:
I don't know how your script works but in my case the function additionally needs:
name:'edit
name : 'edit'
将数据存储在数据库中。
to store the data in the database.
hth :)
dabbeljuh
dabbeljuh
这篇关于Jeditable与jQuery UI Datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!