jedable与jQuery UI Datepicker [英] Jeditable with jQuery UI Datepicker

查看:156
本文介绍了jedable与jQuery UI Datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要点击来编辑页面上的元素,这将反过来调用一个jQuery UI Datepicker的实例。



目前,我正在使用JEditable提供在位编辑,这是正常的。但是,我有一个日期控制输入,我想显示为一个日历,这是乐趣开始的地方。



我在这里发现了一个评论Calle Kabo的博客(该页面有点被捣碎不幸的是)详细说明了一种方法:

  $。editable.addInputType(datepicker,{
元素: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文档就绪功能之外,也不在于它 - 没有喜悦。



我的UI Datepicker类是日期选择器,我的Jeditable类是ajaxedit ,我确定上述的不作为是因为需要在代码中引用他们,但我不知道如何。另外,Jeditable控件是许多元素ID之一,如果有一个方面。



从那些知道更多的任何想法?

解决方案

我也有同样的问题。搜索 http://www.appelsiini.net/projects/jeditable/custom的源代码.html 带给我解决方案。



有一个jquery.jeditable.datepicker.js。把这个在我的代码中添加了一个新的函数datepicker(也在源代码中)。



我不知道你的脚本是如何工作的,但在我的例子中另外需要:


id:'elementid',



name:'edit '


将数据存储在数据库中。



hth :)

dabbeljuh


I need to have a click to edit element on a page, that will in turn invoke an instance of the jQuery UI Datepicker.

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.

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"); }
            });
        }
    });

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.

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.

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:

id : 'elementid',

name : 'edit'

to store the data in the database.

hth :)

dabbeljuh

这篇关于jedable与jQuery UI Datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆