I am unable to delete a row from my JQGrid because I can’t figure out how to send the data I need to the file that holds the MySQL. I am using ColdFusion.
In my JQGrid file, my editurl parameter is set as such:
editurl: url+"process_delete.cfc?method=process_delete®ion="+region,
In my process_delete.cfc file, that holds my MySQL queries, I have this:
DELETE FROM awesome_table
WHERE region = '#region#' AND Field1 = '??????' AND Field2 = '???????'
I know that the MySQL is being reached – no problems there. Also, the region is populated just fine from the URL. No problems there. The problem is that I can’t figure out how to access the data from the row I’m trying to delete in order to populate Field1 and Field2, effectively completing the query. Can anyone help? Thanks.
For Delete I have the following code:
jQuery.jgrid.del = {
caption: "Delete Item",
msg: "Delete record?",
bSubmit: "Delete",
bCancel: "Cancel",
beforeSubmit: function(postdata, formid) {
var rowid = $("#mygrid").getGridParam('selrow');
$("#mygrid").jqGrid('saveRow',rowid,false,'clientArray');
var rowvalues = $("#mygrid").getRowData(rowid);
return [true, ""]
}
When I display the rowid in an alert message box, I get “null” back, so maybe that’s where my problem stems from.
You can either use
delDatawith the propertiesfield1andfield2defined as functions or to useonclickSubmitorbeforeSubmitin which you can dynamically modify theURLused in the DELETE operation or to useserializeDelDatacallback. The best way could depend on other options which you use (for example depends onmtypeused for Delete operation). In the answer I included the references to other answers which shows all the ways in details.For example you can use