I'm having problem with jqGrid delete mechanism as it only send "oper" and "id" parameters in form of POST data (id is the primary key of the table).
The problem is, I need to delete a row based on the id and another column value, let's say user_id. How to add this user_id to the POST data?
I can summarize the issue as the following:
- How to get the cell value (user_id) of the selected row?
- AND, how to add that user_id to the POST data so it can be retrieved from the code behind where the actual delete process takes place.
Sample codes:
jQuery("#tags").jqGrid({
url: "subgrid.process.php,
editurl: "subgrid.process.php?,
datatype: "json",
mtype: "POST",
colNames:['id','user_id','status_type_id'],
colModel:[{name:'id', index:'id', width:100, editable:true},
{name:'user_id', index:'user_id', width:200, editable:true},
{name:'status_type_id', index:'status_type_id', width:200}
],
pager: '#pagernav2',
rowNum:10,
rowList:[10,20,30,40,50,100],
sortname: 'id',
sortorder: "asc",
caption: "Test",
height: 200
});
jQuery("#tags").jqGrid('navGrid','#pagernav2',
{add:true,edit:false,del:true,search:false},
{},
{mtype:"POST",closeAfterAdd:true,reloadAfterSubmit:true}, // add options
{mtype:"POST",reloadAfterSubmit:true}, // del options
{} // search options
);
See Question&Answers more detail:
os