0

Here is code my jqgrid editing through form.

  $("#DataEnergy").jqGrid('navGrid', '#pagergrid',
    {}, //options
     {editdata: { id_res: $('#resurs').val(), id_obj: readCookie('id_obj')} },// add options
     {editdata: { id_res: $('#resurs').val(), id_obj: readCookie('id_obj')} }, // edit options
     {editdata: { id_res: $('#resurs').val(), id_obj: readCookie('id_obj')}  }, // del options
     {} // search options
     );

When editing, the data the editdata must be sent in the post request. Why is not there why?

1 Answers1

0

First of all you should use correct names of parameters: editData and delData (the case is very important in JavaScript).

The next problem is that the call of navGrid will be executed once, but you want probably to have the values of $('#resurs').val() and readCookie('id_obj') at the moment of editing/ading/deliting. To fix the problem you can use function (methods) inside of editData and delData:

var myData = {
        id_res: function () { return $('#resurs').val(); },
        id_obj: function () { return readCookie('id_obj'); }
    };

$("#DataEnergy").jqGrid('navGrid', '#pagergrid',
    {}, // navGrid options
    { editData: myData }, // add options
    { editData: myData }, // edit options
    { delData: myData },  // del options
);

For more information see some other old answers: this, this, this, this

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798