Hi Ray,
Thanks for contacting Syncfusion support.
We created a sample in web API adapter with a delete action in the controller. In the controller we throw an exception in delete action before the server delete the record. When we delete the record in the sample it throws an exception and grid does not remove the record from the client side.
In our sample we display the error message using actionFailure event of ejGrid. We can handle any exceptions(server-side) in the actionFailure event. In this event we can get error messages in arguments and display the error messages in the alert window.
Find the code example and sample:
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: ej.DataManager({ url: "/api/Orders", adaptor: "WebApiAdaptor" }),
allowPaging: true,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
pageSettings: { pageSize: 4 },
actionFailure : "Failure",
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Delete] },
columns: [
---------------------
]
});
});
function Failure(args) {
alert(args.error.error.statusText);
}
</script>
-----------------------------------------------------
public void Delete(int id)
{
throw new Exception();
var order = db.EmployeePhotoes.Find(id);
db.EmployeePhotoes.Remove(order);
db.SaveChanges();
} |
Refer to the Help document for the actionFailure event.
For your convenience we attached a video demonstration.
To reproduce the issue we need the following details,
1. Code example of a Grid and controller.
2. Essential Studio Version details.
3. If possible, replicate the issue in the attached sample.
Regards,
Prasanna Kumar N.S.V