进行编辑操作时,jqgrid会发送"add"消息.作为oper ="add"为什么? [英] Jqgrid on Edit operation sends "add" as oper="add" why?

查看:79
本文介绍了进行编辑操作时,jqgrid会发送"add"消息.作为oper ="add"为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的人.在将数据存储从会话更改为oracle之后,当我在"inlineNav"上单击编辑"时,它总是通过添加"操作转到服务器.为什么会发生这种情况的任何想法?

I have a weird one. After changing the data store from session to oracle, when i hit Edit on the 'inlineNav' it always goes to the server with the "add" operation. Any ideas why this could happened?

$("#assessmentproduct").jqGrid({
            url: 'orthofixServices.asmx/GetProductList',
            colNames: ['id', 'Product Description', 'Commission Rate'],
            colModel: [
            { name: 'id' },
            { name: 'description', index: 'desc', width: 170, editable: true },
            { name: 'commissionrate', index: 'com', width: 80, editable: true, unformat: percentUnFormatter, formatter: percentFormatter, editrules: { number: true} }
            ],
            serializeRowData: function(data) {

                var params = new Object();
                params.id = 0;
                params.prdid = parseInt($("#prdid").val());
                params.description = data.description;
                params.commissionrate = data.commissionrate;
                return JSON.stringify({ 'passformvalue': params, 'oper': data.oper, 'id': data.id });
            },
            mtype: "POST",
            rowNum: 4,
            height: 93,
            width: 400,
            pager: '#assessmentpager',
            editurl: "orthofixServices.asmx/ModifyProductList"
        });
        $("#assessmentproduct").jqGrid('navGrid', '#assessmentpager', { add: false, edit: false, del: true, refresh: false, search: false }, {}, {}, { serializeDelData: function(postData) {
            return JSON.stringify({ 'passformvalue': null, 'oper': postData.oper, 'id': postData.id });
        }
        });
        $("#assessmentproduct").jqGrid('inlineNav', '#assessmentpager', { addParams: { position: "last", addRowParams: {
            "aftersavefunc": function() { var grid = $("#assessmentproduct"); reloadgrid(grid); }
        }
        }, editParams: { "aftersavefunc": function() { var grid = $("#assessmentproduct"); reloadgrid(grid); } }
        });

推荐答案

您可以使用serializeRowData内的JSON.stringify将发布的数据序列化为JSON.这就是您描述编码的原因.

You use JSON.stringify inside of serializeRowData to serialize the posted data to JSON. It's the reason of the encoding which you describe.

已更新:好!现在,我终于看到了问题所在.造成误解的原因是因为您在标题中使用了oper="add"而不是oper=add.我了解到您是您的问题(发送带引号的oper="add"而不是oper=add).好的.在edit操作的情况下发送oper=add的问题是已知的jqGrid错误,该错误已在github上的代码中修复(请参见

UPDATED: OK! Now I see at the end what's the problem. The reason of the misunderstanding was because you used oper="add" in the title instead of oper=add. I understood you that this is your problem (sending of quoted oper="add" instead of oper=add). OK. The problem with sending of oper=add in case of edit operation is known jqGrid bug which is already fixed in the code on the github (see here). You can make the same changes in jquery.jqGrid.src.js and use the fixed code till the new version of jqGrid will released.

这篇关于进行编辑操作时,jqgrid会发送"add"消息.作为oper ="add"为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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