JQGrid中的jQuery UI DatePicker [英] Jquery UI DatePicker In a JQGrid

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

问题描述

我在编辑JQGrid中的单元格时尝试使用日期选择器.当我单击该单元格时,它的确变为文本框,并且显示了日期选择器,但是选择一个日期后,我抛出了以下错误

I am trying to use a datepicker when editing a cell in a JQGrid. When I click in the cell it does change to a text box and the datepicker does display, but after selecting a date I get the following error thrown

Microsoft JScript runtime error: Missing instance data for this datepicker

这是JQGrid的代码

Here is the code for the JQGrid

    var saverow = 0;

var savecol = 0;
$("#requestTable").jqGrid({
    url: url,
    datatype: 'json',
    mtype: 'GET',
    altRows: 'true',
    colNames: ['id', 'Request Date', 'Name', 'HomePhone', 'Address', 'Contact Date(edit)', 'Email'],

    colModel: [
                { name: 'Id', index: 'Id', hidden: true },
                { name: 'RequestDate', index: 'RequestDate', width: 100 },
                { name: 'FullName', index: 'FullName', width: 125, sortable: false },
                { name: 'HomePhone', index: 'CabinetColor', width: 90, sortable: false },
                { name: 'FullAddressString', index: 'ShellColor', width: 260, sortable: false },
                { name: 'DealerContactDate', index: 'DealerContactDate', width: 105, editable: true,
                    editoptions: {
                        dataInit: function (element) {
                            $(element).blur(function () {
                                $("#requestTable").jqGrid("saveCell", saverow, savecol);
                                $("#requestTable").jqGrid("restoreCell", saverow, savecol);
                                $("#requestTable").trigger("reloadGrid");
                            });
                            $(element).datepicker({
                                onSelect: function (dateText, inst) {
                                    $("#requestTable").jqGrid("saveCell", saverow, savecol);
                                }
                            });

                        }
                    }

                },
                { name: 'Email', index: 'Email', width: 110, sortable: false }

            ],
    cellEdit: true,
    pager: '#pager',
    rowNum: 50,
    rowList: [25, 50, 75, 100],
    sortname: 'id',
    sortorder: "desc",
    viewrecords: true,
    height: "100%",
    cellurl: cellurl,
    afterEditCell: function (id, name, val, IRow, ICol) {
        saverow = IRow;
        savecol = ICol;
    }

});

有什么想法为什么会出现此错误? 谢谢!

Any thoughts why I am getting this error? Thanks!

推荐答案

能否请检查您的文本框" id "?它应该包含任何空格或任何不支持的字符,可能会导致 jquery选择器,因此它会在日期选择中引发报告的异常.

Can you please check your textbox "id"?. It should contains any space or any unsupported characters may cause issue jquery selector, hence it throws the reported exceptions in date selection.

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

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