I need to know how to send fields before a delete in jqgrid, to add is easy I have a script for that, but for delete I can't.
here a example to add:
{//add
recreateForm:true,
jqModal:true,
reloadAfterSubmit:true,
savekey: [true,13],
closeOnEscape:true,
closeAfterAdd:true,
height:150,
width:450,
url:"process/jqgridAnaOT.php",
addCaption : "Asigancion de Analista",
beforeSubmit:function(postdata){
var dataString = $("#formid").serialize();
var numReg = document.getElementById('OT').value;
var assign = document.getElementById('Siglas').value;
var txt_open = document.getElementById('txt_open2').value;
if(txt_open==0){
jAlert('La orden se encuentra cerrada, No es posible modificar datos',titulo);
return false;
} else { ...
} },
as you see, to add we have a form which we are able to manipulate the data in, the function beforeSubmit allows us know data in the form, but when we delete a row it does not exist in the form if not a message from jqgrid.
i found a solution
$(function(){
$("#list").jqGrid({
colNames:[...],
colModel :[...],
etc...
});
$("#list").jqGrid('navGrid','#pager',
{add:true,edit:false,del:true,search:false,refresh:true},
{//edit},
{//add},
{//del
code....
}
);
});
In this method i use the interface by default for jqgrid it most clearly to use, using the solution i adapted my code and it work's fine.
{//del
recreateForm:true,
jqModal:true,
reloadAfterSubmit:true,
savekey: [true,13],
closeOnEscape:true,
closeAfterAdd:true,
height:130,
width:450,
url:'process/jqgridAnaOT.php?pid="<?=$strPid?>"',
onclickSubmit: function(params){
var txt_open = document.getElementById('txt_open2').value;
var gr = jQuery("#list").jqGrid('getGridParam','selrow');
var val = jQuery('#list').jqGrid('getCell',gr,'Siglas');
if(txt_open==0){
jAlert('La orden se encuentra cerrada, No es posible modificar datos',titulo);
return false;
}
else {
return {Siglas:val};
}
}
} // fin del
I hope this code has usefull for somebody