使用 jQuery UI Datepicker 可编辑 [英] Jeditable with jQuery UI Datepicker

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

问题描述

我需要单击以编辑页面上的元素,这将反过来调用 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 类是 date-picker 而我的 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?

推荐答案

我也遇到了同样的问题.在 http://www.appelsiini.net/projects/jeditable/custom 的源代码中搜索.html 让我找到了解决方案.

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:

id : 'elementid',

id : 'elementid',

名称:编辑"

将数据存储在数据库中.

to store the data in the database.

第 :)

dabbeljuh

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

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