问题描述
我在 MVC 项目中使用 JQGrid 插件.我试图避免使用会话".使用 JQGrid 中的序列化数据方法,我已经能够将额外的 postdata 传递到我的编辑和删除函数中.
I am using the JQGrid plugin on an MVC project. I am trying to avoid using 'Session'. I have been able to pass extra postdata into my edit and delete functions, using the serializedata methods from JQGrid.
例如
serializeEditData: function (postdata)
{
var rowdata = jQuery('#gridId').getRowData(postdata.id);
return {id: postdata.id, oper: postdata.oper, SomeExtraData: $('#extradata').val()};
}
但是,似乎没有 serializeAddData 函数.是否有另一种方法可以在发送之前更改 add 方法的 post 数据?
However, there doesn't appear to be a serializeAddData function. Is there another way to alter the post data for the add method before it is sent?
推荐答案
有一种方法 editGridRow 实现编辑"和添加"对话框的表单编辑.所以同样的事件han`ler serializeEditData 可以在这两种情况下都使用.例如,
There are one method editGridRow which implement form editing for both "Edit" and "Add" dialogs. So the same event han`ler serializeEditData can be used in both cases. For example,
$("#list").jqGrid('navGrid','#pager',
{/*navGrid options*