使用模式窗体添加新行时,使用jqGrid添加其他参数以发布数据 [英] Add additional param to post data using jqGrid when adding new row with modal form

查看:166
本文介绍了使用模式窗体添加新行时,使用jqGrid添加其他参数以发布数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用模态窗体添加新记录时,我需要为jqGrid的 POST 数据添加额外的动态参数。

I need to add additional dynamic parameter to jqGrid's POST data when I'm adding new record with modal form.

我试过了:

$('#table').setPostData({group: id});
$('#table').setPostDataItem('group', id);
$('#table').setGridParam('group', id);

没有任何结果。

推荐答案

您可以使用 editData editGridRow 方法的参数。在大多数情况下,您不能直接使用 editGridRow ,但是使用Navigator。在这种情况下,您可以将 editData 定义为零件<$ href =http://www.trirand.com/jqgridwiki/doku的 prmEdit prmAdd .php?id = wiki:navigator #definitionrel =nofollow noreferrer> navGrid :

you can use editData parameter of the editGridRow method. In the most cases you use editGridRow not directly, but using Navigator. In the case you can define editData as the part of prmEdit or prmAdd of the navGrid:

$('#table').jqGrid('navGrid','#pager',
                   {/*navGrid options*/},
                   {/*Edit options*/
                       editData: {
                           group: function() {
                               return id;
                           }
                       }
                   }
});

还有一个选项是 serializeEditData onclickSubmit beforeSubmit 方法。请参阅此处这里

One more option is the serializeEditData, onclickSubmit or beforeSubmit method. See details here and here.

这篇关于使用模式窗体添加新行时,使用jqGrid添加其他参数以发布数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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