I’m trying to show the server error to the user on JqGrid
here is my code:
function addRow() {
$("#updateList").jqGrid('editGridRow', "new", {
editData: {
Year: function () { return $('#year option:selected').val(); }
}
, afterSubmit: function (response, postdata) { return [false, "fdfdfdfd", "141"]; }
, height: 400, width: 400, reloadAfterSubmit: true
});
}
I do get the json error from Server with StatusCode 500
I just wanted to test so I put
return [false, "fdfdfdfd", "141"]
But I always see the default error message
“error Status: ‘error’. Error code: 500”
This is a ‘new’ row adding model form. not inline editing.
Thanks for any help…
There are misunderstanding when
afterSubmitcan be used. The function could be helpful if your server framework produce always successful HTTP code and you can only place the information about the error inside of the body of the successful response.In your case the server returns status code 500. So you should use errorTextFormat instead. Try with
More interesting implementation of
errorTextFormatyou can find for example here. I recommend you additionally to read the answer and play with the demo from the answer.