delting of a row in jqgrid and "error Status: 'Not Found'. Error code: 404"
I have a problem concern the delting of a row in JQGrid. I have a table editable where it's allow to modify all row in the client side and then save all at the end of modification, It works fine but I have some problem with deleting of row, because it send by post method to a dummy page by default functionality of JQGrid and I have the error:
error Status: 'Not Found'. Error code: 404 94022 Delete selected record(s)?
I imagine that is because it wait a status rensponse of the delete operation. some one know how I can delete row without send anything or to force a status return with some code? Thanks in advance.
the code of my table is:
jQuery('#listBody').jqGrid({
url:'sow.ajax.php',
datatype: 'xml',
colNames:['Pl Section','Id Document','Id Service','Code','Quantity'],
colModel:[
{name:开发者_运维知识库'id_parent',index:'id_parent',hidden:false},
{name:'id_document',index:'id_document',hidden:true},
{name:'id_service',index:'id_service',hidden:true},
{name:'code',index:'code', width:80},
{name:'quantity',index:'quantity', width:80, align:\"right\", sorttype:\"int\", editable: true,editrules:{number:true}}
],
rownumbers:true,
rowNum:100,
height:500,
cellEdit: true,
cellsubmit: 'clientArray',
multiselect: true,
gridComplete : function(){
var ids = $('#listBody').jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
var rowdata=jQuery('#listBody').jqGrid ('getRowData', ids[i]);
service_sow[rowdata['id_service']]=i;
}
},
editurl:'ClientArray',
rowList:[10,20,30],
sortname: 'id',
viewrecords: true,
sortorder: "desc",
loadonce: true,
caption: "Document body",
pager: '#plistBody'
});
jQuery('#listBody').jqGrid('navGrid','#plistBody',{edit:false,add:true,del:true,search:false});
$('#dedata').click(function(){
var gr = jQuery('#listBody').jqGrid('getGridParam','selrow');
if( gr != null ) jQuery('#listBody').jqGrid('delGridRow',gr,{reloadAfterSubmit:false});
else alert("Please Select Row to delete!");
});
I have found this and it seems to work fine:
$('#del-row')
.button(
{
icons: {
primary:'ui-icon-trash'
}
}
)
.click(function() {
var selectedRowsJq = new Array();
var selectedRows = new Array();
selectedRowsJq=jQuery('#listBody').getGridParam('selarrrow');
for(var i = 0; i < selectedRowsJq.length; i++)selectedRows[i]=selectedRowsJq[i];
for(var i = 0; i < selectedRows.length; i++){
//DEBUG//alert(selectedRows[i]);
jQuery('#listBody').delRowData(selectedRows[i]);
}
return false;
});
Tanks to all ;))
精彩评论