My problem is this, I want to show errors through the information I get the json. That is, when we added / edited in jgrid something we always expect to get a response in json data. Then I remembered what it was, if you can not add something, I send in the json error.
I wanted to show the error using the Highlight / Error in Jquery. And therein lies my problem, how do I show it. From what I’ve been searching, should be the attribute aftersubmit implement and handle the response here but just that I am not getting.
Code:
afterSubmit: function (response)
{
if(responce == false)
alert("test");
}
Format error in json:
{"Response":false,"Message":"Dados inválidos"}
Someone can help me?
—————————————- SOLUTION ——————————————————
jQuery.extend(jQuery.jgrid.edit,
{
reloadAfterSubmit:false,
afterSubmit: function (response, postdata)
{
if(jQuery.parseJSON(response.responseText).Response == false)
{
alert(jQuery.parseJSON(response.responseText).Message);
return [false,null,null];
}
else
{
return [true,null,null];
}
}
});
Try this