title: Ext Data Session and bad server response ("[W] Ignoring server record: ...")
body: <p>Our application handles and manages records changes on the client side. We use ExtJS5 <a href="http://docs.sencha.com/extjs/5.0/whats_new/5.0/whats_new.html#Data_Sessions" rel="nofollow">Data Session</a> mechanism.</p>
  
  <blockquote>
    <p>A session tracks records that need to be updated, created or destroyed
    on the server. It can also order these operations to ensure that newly
    created records properly reference other newly created records by
    their new, server-assigned id.</p>
  </blockquote>
  
  <p>Let me introduce short use case.
  User opens and fills a form. Behind the scene fields are binded to entity object which is tracked by session. When user clicks Submit then session is synchronized, i.e. Ext sends requests to the server and parse response. Here I've encountered a problem.</p>
  
  <p>Server returns following object but Ext does not recognize it:</p>
  
  <pre><code>[{"success": false, errorMessage: "error"}]
  </code></pre>
  
  <p>Ext prints warning:</p>
  
  <pre><code>[W] Ignoring server record: {"success":false} 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>[W] Ignoring server record: {"success":true} 
  </code></pre>
  
  <p>My question is <strong>how should look server response in order to indicate that record is not accepted/saved by backend?</strong></p>
  
  <p>The source code where above warning is printed: <a href="http://docs-origin.sencha.com/extjs/5.0/apidocs/source/Operation.html" rel="nofollow">http://docs-origin.sencha.com/extjs/5.0/apidocs/source/Operation.html</a> (in function <code>doProcess</code>)</p>
  
  <p>Below I put snippet how I'm starting a batch operation (sync session):</p>
  
  <pre><code>var session = this.getViewModel().getSession(),
    saveBatch = session.getSaveBatch();
  
  saveBatch.on('complete', function (batch, operation, eOpts) {
    // whole batch processing has been completed
    /*...*/
  });
  saveBatch.on('exception', function (batch, operation, eOpts) {
    // exception has been occurred (possible for each operation) (such as HTTP 500) 
    /*...*/
  });
  saveBatch.on('operationcomplete', function (batch, operation, eOpts) {
    // single operation has been completed
    // now, every operation is marked as successful
    /*...*/
  });
  saveBatch.start();
  </code></pre>
  
  <p><strong>update 26.09.2014</strong></p>
  
  <p>Sencha developer has suggested including an id of object in the response. so I've modified server response to:</p>
  
  <pre><code>[{"id": 10, "success": false}]
  </code></pre>
  
  <p>but this does not solve the problem.</p>