I am trying to customize the delete function in jqGrid.
I have enabled the delete button on the grid
$("#myGrid").jqGrid('navGrid', '#pager',
{ add: true, addtitle: 'Add Customer',
edit: true, edittitle: 'Edit Customer',
del: true, deltitle: 'Delete Customer',
refresh: true, refreshtitle: 'Refresh data',
search: true, searchtitle: 'Apply filters',
addfunc: addForo, editfunc: editForo,
cloneToTop: true
},
{}, // default settings for edit
{}, // default settings for add
{}, // default settings for delete
{ closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }, // search options
{} // default settings for view
);
then I have added (thanks to this post) the following code
$("#bDelete").click(function () {
// Get the currently selected row
toDelete = $("#myGrid").jqGrid('getGridParam', 'selrow');
$("#myGrid").jqGrid(
'delGridRow',
toDelete,
{ url: '/Foro/Delete/' + toDelete, mtype: 'post', reloadAfterSubmit: false }
);
});
Now when I click on the delete button a dialog is shown asking for delete confirm. But if I click on the delete button I will get the following error message
Where am I wrong?
See Question&Answers more detail:os