title: Not storing value on localstorage in sencha
body: <p>I am trying to store data offline aspect, but here i want to store data on localstorage, did not store able to store this, all value getting null in localstorage.</p>
  
  <p>This the based on ; <a href="http://www.robertkehoe.com/2012/11/sencha-touch-2-localstorage-example/" rel="nofollow">http://www.robertkehoe.com/2012/11/sencha-touch-2-localstorage-example/</a></p>
  
  <p><strong>Models:</strong>
  *<em>Online.js</em>*</p>
  
  <pre><code>Ext.define('default.model.Online', {
    extend: 'Ext.data.Model',
    config: {
      fields: [
                      'cat_id',
                      'category_name'
                  ]
    }
  });
  </code></pre>
  
  <p><strong>Offline.js</strong></p>
  
  <pre><code>Ext.define('default.model.Offline', {
    extend: 'Ext.data.Model',
    config: {
      fields: [
                      'cat_id',
                      'category_name'
                  ],
      identifier:'uuid', // IMPORTANT, needed to avoid console warnings!
      proxy: {
        type: 'localstorage',
        id  : 'category'
      }
    }
  });
  </code></pre>
  
  <p><strong>Stores:</strong></p>
  
  <pre><code>Ext.define('default.store.News', {
    extend:'Ext.data.Store',
  
  
    config:{
      model:'default.model.Online',
      proxy: {
        timeout: 3000, // How long to wait before going into "Offline" mode, in milliseconds.
        type: 'ajax',
        url: 'http://alucio.com.np/trunk/dev/sillydic/admin/api/word/categories/SDSILLYTOKEN/650773253e7f157a93c53d47a866204dedc7c363?_dc=1376475408437&amp;page=1&amp;start=0&amp;limit=25' , // Sample URL that simulates offline mode. Example.org does not allow cross-domain requests so this will always fail
        reader: {
                  type: "json",
                  rootProperty: "data"
              }
        },
      autoLoad: true
    }
  });
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>Ext.define('default.controller.Core', {
    extend : 'Ext.app.Controller',
  
    config : {
      refs    : {
        newsList   : '#newsList'
      }
    },
    init : function () {
      var onlineStore = Ext.getStore('News'),
        localStore = Ext.create('Ext.data.Store', {
          model: "default.model.Offline"
        }),
        me = this;
  
      localStore.load();
  
      onlineStore.on('refresh', function (store,record) {
       Ext.Msg.alert('Notice', 'You are in online mode', Ext.emptyFn);
        //  console.dir(record.data.name);
          console.dir(record.get('category_name'));
          console.log(record.items[0].raw.category_name);
          console.log(record.get('category_name'));
        // Get rid of old records, so store can be repopulated with latest details
        localStore.getProxy().clear();
  
        store.each(function(record) {
  
          var rec = {
            name : record.data.category_name+ ' (from localStorage)' // in a real app you would not update a real field like this!
          };
  
          localStore.add(rec);
          localStore.sync();
        });
  
      });
        onlineStore.getProxy().on('exception', function () {
        me.getNewsList().setStore(localStore); //rebind the view to the local store
        localStore.load(); // This causes the "loading" mask to disappear
        Ext.Msg.alert('Notice', 'You are in offline mode', Ext.emptyFn); //alert the user that they are in offline mode
      });
  
    }
  });
  </code></pre>
  
  <p>I think, I am not getting value from this <strong>record.data.category_nam</strong> . Here I am getting first value from this:<strong>record.items[0].raw.category_name</strong>. So how to store in localstorage.
  and View file:</p>
  
  <pre><code>Ext.define('default.view.Main', {
    extend : 'Ext.List',
  
    config : {
      id               : 'newsList',
      store            : 'News',
      disableSelection : false,
      itemTpl          : Ext.create('Ext.XTemplate',
        '{category_name}'
      ),
      items            : {
        docked : 'top',
        xtype  : 'titlebar',
        title  : 'News List'
      }
    }
  });
  </code></pre>
  
  <p>In localstorage, following output:</p>
  
  <pre><code>category-5ea01a8d-ef1e-469e-8ec4-790ec7306aaf
  {"cat_id":null,"category_name":null,"id":"5ea01a8d-ef1e-469e-8ec4-790ec7306aaf"}
  category-f3e090dd-8f25-4b20-bb6e-b1a030e07900
  {"cat_id":null,"category_name":null,"id":"f3e090dd-8f25-4b20-bb6e-b1a030e07900"}
  category-5148e6eb-85ae-4acd-9dcd-517552cf5d97
  {"cat_id":null,"category_name":null,"id":"5148e6eb-85ae-4acd-9dcd-517552cf5d97"}
  category-ec23ff8b-1faa-4f62-9284-d1281707a9bc
  {"cat_id":null,"category_name":null,"id":"ec23ff8b-1faa-4f62-9284-d1281707a9bc"}
  category-6c1d
  </code></pre>
  
  <p>I have display in view but could not store in localstorage for offline propose.where i did wrong, i could not get it.</p>