View Full Version : How to show server-side validation errors after sync of an editable GRID

8 Mar 2012, 2:57 AM
Sending grid data to the server with the sync() method works fine. Doing this in BATCH mode, on some records validations can fail on server side. I would like to mark the failed records inside the grid.

Idea (using Ext 4.1):
After each sync action, the server returns a json including the errors like:

{ "success": false:
"errors": {
"id1": {"city": "can't be blank"},
"id2": {"city": "can't be blank", "zip": "format error"}

Then I execute the sync like:

{callback:function(batch, options){
var i;
for (i=0; i<batch.exceptions.lenght; i++){
var errorJson = batch.exceptions[i].errors
// next step: how to mark records in grid invalid?
// should look like a failed validation

I am not sure if this is the correct way. Can I send the error JSON in an other format and EXT marks the failed records per default?

Thanks a lot for any idea or hint.

8 Mar 2012, 4:52 PM
If errorJson is what you need then this is ok.