title: ExtJs 4.2 error 'getById called for ID that is not present in local cache' when refreshing the gird
body: <p>Here is what I have:
  <img src="https://i.stack.imgur.com/9XtjP.png" alt="enter image description here" /></p>
  <p>When clicking on one of the boxes the list below gets filtered on the server side.</p>
  <p>If I select on of the rows in the grid and then commit a filter, I get the following error:</p>
  <p><em>&quot;getById called for ID that is not present in local cache&quot;</em></p>
  <p><img src="https://i.stack.imgur.com/Tv2l1.png" alt="enter image description here" /></p>
  <p>This gets raised even if the filter does include the record that I have selected.</p>
  <p>Here is the module:</p>
  <pre><code>Ext.define('NG.model.auxClasses.notifications.WhatsNew', {
      extend: 'Ext.data.Model',
      idProperty: 'iD',
      autoLoad: true,
      fields: [
          { name: 'iD', type: 'int' },
          { name: 'isActive', type: 'boolean' },
          { name: 'documentIdentifier', type: 'string' },
          { name: 'sourceSiteName', type: 'string' },
          { name: 'targetSiteName', type: 'string' },
          { name: 'createDate', type: 'date', dateFormat: 'c' },
          { name: 'businessArchiveEvent', type: 'string' },
          { name: 'businessArchive', type: 'string' },
          { name: 'previousWhatsNewEvents' },
          { name: 'isPin', type: 'boolean' },
          { name: 'IsDocumentReadByMe', type: 'boolean' },
          { name: 'isDocumentReadByOthers', type: 'boolean' },
          { name: 'documentYear', type: 'int' },
          { name: 'businessDirection', type:'int'}
      ],
  
      // self association model
      associations: [{
          type: 'hasMany',
          model: 'auxClasses.notifications.WhatsNew',
          name: 'previousWhatsNewEvents',
          primaryKey: 'id',
          associationKey: 'previousWhatsNewEvents'
      }],
  
      proxy: {
          type: 'rest',
          url: 'api/WhatsNew/'
      }
  
  });
  </code></pre>
  <p>Here is the store:</p>
  <pre><code>Ext.define('NG.store.WhatsNews', {
      extend: 'NG.store.AbstractStore',
      model: 'NG.model.auxClasses.notifications.WhatsNew',
      alias: 'store.whatsnewstore',
      autoLoad:true,
      buffered: true,
      pageSize: 50
  });
  </code></pre>
  <p><strong>UPDATE:</strong></p>
  <p>I have followed the rabbit to the hole and found a workaround that I am not sure will work:</p>
  <p>Here is where I failing:</p>
  <pre><code>refresh: function() {
          ...
  
          // Don't need to do this on the first refresh
          if (me.hasFirstRefresh) {
          // Some subclasses do not need to do this. TableView does not need to do this.                   
                 if (me.refreshSelmodelOnRefresh !== false) {
                      me.selModel.refresh();
                  } else {
                      // However, even if that is not needed, pruning if pruneRemoved is true (the default) still needs doing.
                      me.selModel.pruneIf(); &lt;&lt;&lt; HERE WE FAIL. THIS METHODS CALLS THE GET BY ID
                  }
              }
  
             ...
      }
  </code></pre>
  <p>So on my view I have added the following view config:</p>
  <pre><code>viewConfig: {
          refreshSelmodelOnRefresh:true // Workaround : if this is not set to true when the grid will refresh and a record will be selected we will get an ext error 
      },
  </code></pre>
  <p>This has solved the error being raised, but I am unsure of the end result and what it might harm later on.</p>
  <p>If someone can shade some light...</p>
  <p>Is there a workaround for that?</p>