title: Ext JS 4 store load callback
body: <p>I'm trying to build a simple user setting feature for my school project.<br/>
  I've created a data model like so:</p>
  
  <pre><code>Ext.define('Urlopy.Model.UserPreferences', {
          extend : 'Ext.data.Model',
          idProperty : 'userID',
          fields : [{
                      name : 'userID',
                      type : 'string'
                  }, {
                      name : 'admin',
                      type : 'bool'
                  }]
      });
  </code></pre>
  
  <p>and a store like this:</p>
  
  <pre><code>Ext.define('Urlopy.Store.UserPreferences', {
          extend : "Ext.data.Store",
          autoLoad : false,
          autoSync : true,
          batch : false,
          proxy : {
              type : 'ajax',
              sortParam : undefined,
              startParam : undefined,
              pageParam : undefined,
              limitParam : undefined,
              noCache : false,
              headers : {
                  "Content-Type" : "application/json; charset=utf-8"
              },
              api : {
                  read : 'services/UserPreferences.asmx/Get',
                  update : 'services/UserPreferences.asmx/Update'
              },
              reader : {
                  type : 'json',
                  root : 'd.data'
              },
              writer : {
                  type : 'json',
                  encode : false,
                  writeAllFields : true,
                  root : 'data'
              }
          },
          model : 'Urlopy.Model.UserPreferences'
      });
  </code></pre>
  
  <p>In my application when user logs in I would like to get his preferences.</p>
  
  <p>I have a function like so:</p>
  
  <pre><code>onLogin : function() {
  
              this.createGlobalStores();
  
              this.userPreferenceStore.load({
  
                          callback : function(r, options, success) {
                              console.log(r.data)
                          }
  
                      });
  
          },
          createGlobalStores : function() {
              this.userPreferenceStore = Ext.create("Urlopy.Store.UserPreferences");
          },
  </code></pre>
  
  <p>What I would like to do in callback is to get userID and display it, even using simple alert.</p>
  
  <p>Right now all I get is undefined that shows in firebug.</p>
  
  <p>My json data from server looks like this:</p>
  
  <pre><code>{"d":{"__type":"Urlopy.services.UserPreference","userID":"12445","admin":true}}
  </code></pre>
  
  <p>I need to be able to call load method on that store and in callback get specific property from model. My store will always have 1 item! (is there another way to do this?)</p>
  
  <p>Any ideas on why this isn't working are welcome!</p>
  
  <p><strong>EDIT</strong>
  I've changed my server script to return json like this:</p>
  
  <pre><code>{"d":{"data":{"userID":"12-44-55","admin":true}}}
  </code></pre>
  
  <p>This works fine, there were no need to add extra [] around object.</p>