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

查看:12
本文介绍了Jeditable 与 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 类是日期选择器,而我的 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

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

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