Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery jqgrid:未将editData发送到服务器_Jquery_Jqgrid - Fatal编程技术网

Jquery jqgrid:未将editData发送到服务器

Jquery jqgrid:未将editData发送到服务器,jquery,jqgrid,Jquery,Jqgrid,我使用的是guriddo jqGrid 5.2.1 我遵循了这些问题的答案: 但是我定义的editData没有被发送到端点 以下是我的jqgrid寻呼机定义中的代码: $('#jqGrid').navGrid('#jqGridPager', // the buttons to appear on the toolbar of the grid { edit: true, add: true,

我使用的是guriddo jqGrid 5.2.1

我遵循了这些问题的答案:

但是我定义的editData没有被发送到端点

以下是我的jqgrid寻呼机定义中的代码:

$('#jqGrid').navGrid('#jqGridPager',
            // the buttons to appear on the toolbar of the grid
            { edit: true, 
                add: true, 
                del: true, 
                search: false, 
                refresh: false, 
                view: false, 
                position: "left", 
                cloneToTop: false,
                mtype: 'POST',
                editData: {
                    mediaPlanId : function() { return mpId; }
                }},
            // options for the Edit Dialog
            {
                editCaption: "Edit Item",
                recreateForm: true,
                checkOnUpdate : true,
                checkOnSubmit : true,
                closeAfterEdit: true,
                errorTextFormat: function (data) {
                    return 'Error: ' + data.responseText;
                }
            },
            // options for the Add Dialog
            {
                closeAfterAdd: true,
                recreateForm: true,
                errorTextFormat: function (data) {
                    return 'Error: ' + data.responseText;
                }
            },
            // options for the Delete Dailog
            {
                errorTextFormat: function (data) {
                    return 'Error: ' + data.responseText;
                }
            }

    );

mpId是在jqGrid和jqGridPager函数之外的页面级别定义的。我尝试发送值1,但也不起作用。我怀疑我遗漏了一些简单的内容,但我不知道是什么。

您将
editData
参数放错了位置。
navGrid
的选项非常糟糕,很容易出错。我在我开发的fork中详细描述了这个问题

当前,您将
editData
放置在
navGrid
的选项中,而不是将其放置在的编辑/添加选项中。这个问题在免费jqGrid中解决了,但是如果您确实喜欢使用的商业版本,那么我建议您以以下方式重写代码:

var myErrorFunc = function (data) {
        return 'Error: ' + data.responseText;
    },
    addEditFormOptions = {
        editCaption: "Edit Item",
        recreateForm: true,
        checkOnUpdate : true,
        checkOnSubmit : true,
        closeAfterEdit: true,
        closeAfterAdd: true,
        editData: {
            mediaPlanId : function() { return mpId; }
        },
        errorTextFormat: myErrorFunc
    },
    delOptions = {
        errorTextFormat: myErrorFunc
    };

$('#jqGrid').navGrid('#jqGridPager', { search: false, refresh: false },
    addEditFormOptions, addEditFormOptions, delOptions);

您将
editData
参数放置在错误的位置。
navGrid
的选项非常糟糕,很容易出错。我在我开发的fork中详细描述了这个问题

当前,您将
editData
放置在
navGrid
的选项中,而不是将其放置在的编辑/添加选项中。这个问题在免费jqGrid中解决了,但是如果您确实喜欢使用的商业版本,那么我建议您以以下方式重写代码:

var myErrorFunc = function (data) {
        return 'Error: ' + data.responseText;
    },
    addEditFormOptions = {
        editCaption: "Edit Item",
        recreateForm: true,
        checkOnUpdate : true,
        checkOnSubmit : true,
        closeAfterEdit: true,
        closeAfterAdd: true,
        editData: {
            mediaPlanId : function() { return mpId; }
        },
        errorTextFormat: myErrorFunc
    },
    delOptions = {
        errorTextFormat: myErrorFunc
    };

$('#jqGrid').navGrid('#jqGridPager', { search: false, refresh: false },
    addEditFormOptions, addEditFormOptions, delOptions);

我认为更好的方法是先阅读,这将指导您将参数放置在何处。

我认为更好的方法是先阅读,这将指导您将参数放置在何处。

您使用的是哪个版本?感谢您指出这一点!我更新了这个问题,把它包括进去。你用的是哪个版本?谢谢你指出!我更新了这个问题,把它包括进去。我没有意识到文档有更新。我一直在引用旧的jqgrid wiki。谢谢你让我知道!我没有意识到文档有更新。我一直在引用旧的jqgrid wiki。谢谢你让我知道!