Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add additional param to post data using jqGrid when adding new row with modal form

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

I tried:

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

and nothing worked out.

like image 778
Teneff Avatar asked May 31 '11 07:05

Teneff


2 Answers

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;
                           }
                       }
                   }
});

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

like image 97
Oleg Avatar answered Nov 03 '22 00:11

Oleg


You can add additional dynamic parameter to jqGrid's POST data

$j("#listsg11").jqGrid({
    url: "/summary_reports",   
    postData: {department:"value1", score_r1:"value2", designation:"value3" },
    mtype: 'POST',
    datatype: "xml",
    height: 250,
    width: '100%', .... and so on

This method appends values with default params (used by jqGrid) with call.

like image 38
Abdul Basit Avatar answered Nov 03 '22 00:11

Abdul Basit