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.
E.G.
serializeEditData: function (postdata)
{
var rowdata = jQuery('#gridId').getRowData(postdata.id);
return {id: postdata.id, oper: postdata.oper, SomeExtraData: $('#extradata').val()};
}
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?
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,
/ );
Typically
serializeEditData
event is very practical if you need convert all the posted data in another format, for example to make JSON serialization. To be able to pass extra postdata parameters you can useeditData
parameter instead which has the same meaning likepostData
parameter of jqGrid:or better in this way (see this answer about the usage of functions as the property of
postData
):