Custom Delete Function in jqGrid

后端 未结 1 625
灰色年华
灰色年华 2020-12-20 00:16

I am trying to customize the delete function in jqGrid.

I have enabled the delete button on the grid

$(\"#myGrid\").jqGrid(\'navGrid\', \'#pager\',
          


        
相关标签:
1条回答
  • 2020-12-20 00:52

    If I understand you correct you want to modify the url used to delete of row so that the id of the row will be a part of the url. You can do this much easier:

    $("#myGrid").jqGrid('navGrid', '#pager',
        // define navGrid options and paraneters of Edit and Add dialogs
        { // now define settings for Delete dialog
          mtype: "POST", reloadAfterSubmit: false,
          onclickSubmit: function(rp_ge, postdata) {
              rp_ge.url = '/Foro/Delete/'+ postdata;
          },
          serializeDelData: function (postdata) { return ""; }
        },
        // search options
        // ...
    );
    

    With respect of onclickSubmit we can modify the url and defining of serializeDelData we can clear the body of the "POST" message. I peronally mostly use RESTfull services on the server side and use mtype: "DELETE". In the case to clear of the body is really needed.

    One more option is to use delfunc like you already use editfunc and addfunc. In the most cases the usage of such function is not really needed and one can implement the same in other way.

    0 讨论(0)
提交回复
热议问题