Error handling with afterSubmit not appearing in new JqGrid model model

I am trying to show a server error to a 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 get json error from server with StatusCode 500 I just wanted to check, so I put

return [false, "fdfdfdfd", "141"]

But I always see the default error message

"Error:" error ". Error code: 500"

This is a new line adding a model form. not inline editing.

Thanks for any help ...

+3
source share
1 answer

When using afterSubmit, misunderstandings may occur. This function can be useful if you always get a successful HTTP code in your server structure, and you can only put error information inside the body of a successful response.

500. , errorTextFormat.

errorTextFormat: function (response) {
    return "ERROR: fdfdfdfd!";
}

errorTextFormat , , . .

+3

All Articles