title: ExtJS 4.2.1 - reject changes in store after getting error from server
body: <p>In my application I'm deleting records using this code:</p>
  
  <pre><code>//try to delete item
  s.eventStore.remove(s.ctx.rec);
  //error handling
  s.eventStore.getProxy().on({
      exception: function() {
          s.eventStore.rejectChanges();
          Ext.MessageBox.show({
              title: 'Server error',
              msg: 'data restored',
              icon: Ext.MessageBox.ERROR,
              buttons: Ext.Msg.OK
          });
      }
  });
  </code></pre>
  
  <p><strong>This works fine</strong>, but I would like to avoid adding listeners in every place, instead I would like to add one listener in my store.<br/>
  I've tried modifying my store like this:</p>
  
  <pre><code>Ext.define('Urlopy.Store.Holidays', {
      extend: "Sch.data.EventStore",
      autoLoad: false,//zmiana
      autoSync: true,
      batch: false,
      proxy: {
          type: 'rest',
          pageParam: false, //to remove param "page"
          startParam: false, //to remove param "start"
          limitParam: false, //to remove param "limit"
          noCache: false, //to remove param "_dc"
          url: window.appUrl + 'api/Holidays',
          reader: {
              type: 'json',
              root: 'data'
          },
          writer: {
              type: 'json'
          },
          listeners: {
              exception: function (store, response, operation) {
                      var data = Ext.decode(response.responseText);
                      Ext.MessageBox.show({
                          title: 'Server error',
                          msg: data.Message,
                          icon: Ext.MessageBox.ERROR,
                          buttons: Ext.Msg.OK
                      });
                      store.rejectChanges();
              }
          }
      },
      model: 'Urlopy.Model.Holiday'
  });
  </code></pre>
  
  <p>This is basically same listener, but when I try to rejectChanges I get this error:</p>
  
  <pre><code>Uncaught TypeError: Object [object Object] has no method 'rejectChanges'
  </code></pre>
  
  <p>How can I modify my store to have global exception handling and restore events if something goes wrong on server?</p>
  
  <p>I don't want to use solution from <a href="https://stackoverflow.com/questions/7870691/cancel-store-remove-after-server-call-in-extjs-4">Cancel store.remove after server call in ExtJS 4</a> (store.add(store.getRemovedRecords());)</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I've updated my stode definition to this:</p>
  
  <pre><code>Ext.define('Urlopy.Store.Holidays', {
      extend: "Sch.data.EventStore",
      autoLoad: false,
      autoSync: true,
      batch: false,
      proxy: {
          type: 'rest',
          pageParam: false, //to remove param "page"
          startParam: false, //to remove param "start"
          limitParam: false, //to remove param "limit"
          noCache: false, //to remove param "_dc"
          url: window.appUrl + 'api/Holidays',
          reader: {
              type: 'json',
              root: 'data'
          },
          writer: {
              type: 'json'
          },
          listeners: {
              exception: function(proxy, response, operation) {
  
                  console.log(this);
                  this.rejectChanges();
              },
              scope: this
          }
      },
      model: 'Urlopy.Model.Holiday'
  });
  </code></pre>
  
  <p>but still I get same error and console outputs Window object instead of store.</p>