I am updating an igGrid with the code below. It works great if there are no database save issues.
Client side (most code eliminated for clarity)
...
.Rest(true) .RestSettings(rs => { rs.RestSetting() .Update(u => u.RestVerbSetting() .Template(Url.Content("~/api/EditBatchAPI?DetailId=${id}")) .Batch(false) ); }) .Render()
It is calling this Server Side:
[HttpPut] public void Put(int chainPricingDetailId, [FromBody]ChainPricingDetailBrandData value) { try {
How can I give feedback to the user if the Put failed?
Hello Kenn,
Thank you for posting in our forum.
The saveChanges method allows defining a success and an error handler functions:
https://www.igniteui.com/help/api/2019.2/ui.igGrid#methods:saveChanges
You can use the error handler, which is triggered when the updating request has failed (for example if the request has resulted in a server side error).
In it you can show some indication to the user that the updating has failed. For example:
grid.igGrid("saveChanges", function saveSuccess() { alert("Success"); }, function saveError() { alert("Error"); });
Let me know if you have any additional questions or concerns.
Regards,
Maya Kirova
That worked and I am including my Solution for those looking for how to parse out the exception to something friendly.
$("#PricingGrid").igGrid("saveChanges", function (data) { //Success normal processing }, function (jqXHR, textStatus, errorThrown) { var responseTextObject = JSON.parse(jqXHR.responseText); alert(responseTextObject['ExceptionMessage']); } );
Thank you for sharing your code. I’m glad to hear you solved your issue.