Results 1 to 2 of 2

Thread: How to show server-side validation errors after sync of an editable GRID

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    23
    Vote Rating
    0
      0  

    Default How to show server-side validation errors after sync of an editable GRID

    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:

    Code:
    { "success": false:
      "errors": {
         "id1": {"city": "can't be blank"},
         "id2": {"city": "can't be blank", "zip": "format error"}
    }
    Then I execute the sync like:

    Code:
     this.getStore().sync(
     {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.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,381
    Answers
    3997
    Vote Rating
    1536
      0  

    Default

    If errorJson is what you need then this is ok.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •