在使用模态表单添加新行时使用 jqGrid 添加其他参数以发布数据 [英] Add additional param to post data using jqGrid when adding new row with modal form
问题描述
当我以模态形式添加新记录时,我需要向 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);
什么都没解决.
推荐答案
你可以使用 的="nofollow noreferrer">editData 参数editGridRow 方法.在大多数情况下,您不直接使用 editGridRow,但使用导航器.在这种情况下,您可以将 editData 定义为部分prmEdit 或 prmAdd
的="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屋!