title: Sencha Touch - localstorage problems
body: <p>I'm having a few problems with Sencha Touch and localstorage...</p>
  
  <p>1) I am able to save data into localstorage, and it works great until I refresh the page. After that point I can still access the data, appear to make changes, and even add new entries. But as soon as the page is refreshed, all of my updates are gone. Anything that was newly added will be fine, but updates to original entries will not be saved (hopefully this makes sense). Basically, I can create an entry and update it all I want until I refresh the page. At that point it will not save to localstorage again. New entries always save fine though.</p>
  
  <p>2) When I delete all entries my entries and then refresh the page, I get this error in the console: "Uncaught TypeError: Cannot read property 'id' of null". It looks like it's trying to load something even though nothing is there. I'm not sure why it would throw an error in this situation and not when the page is originally loaded since it should be the same thing right?</p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>    Ext.regModel('inventoryItem', {
          idProperty: 'id',
          fields: [
              { name: 'id', type: 'int' },
              { name: 'date', type: 'date', dateFormat: 'c' },
              { name: 'title', type: 'string' },
              { name: 'quantity', type: 'int' },
              { name: 'size', type: 'int' },
              { name: 'cost', type: 'double' },
              { name: 'startDate', type: 'date' },
              { name: 'endDate', type: 'date' },
              { name: 'dailyAvgCost', type: 'string' },
              { name: 'dailyAvgSize', type: 'string' }
          ]
      });
  </code></pre>
  
  <p><strong>Store:</strong></p>
  
  <pre><code>    Ext.regStore('inventoryItemsStore', {
          model: 'inventoryItem',
          sorters: [{
              property: 'id',
              direction: 'DESC'
          }],
          proxy: {
              type: 'localstorage',
              id: 'inventory-app-store'
          },
          getGroupString: function (record) {
              return '';
          }
      });
  </code></pre>
  
  <p><strong>Handler:</strong></p>
  
  <pre><code>     {
               var currentinventoryItem = CostsApp.views.inventoryEditor.getRecord();
               CostsApp.views.inventoryEditor.updateRecord(currentinventoryItem);
               var inventoryStore = CostsApp.views.inventoryList.getStore();
               if (null == inventoryStore.findRecord('id', currentinventoryItem.data.id))
               {
                       inventoryStore.add(currentinventoryItem);
               }
  
               inventoryStore.sync();
               inventoryStore.sort([{ property: 'date', direction: 'DESC'}]);
               CostsApp.views.inventoryList.refresh();
        }
  </code></pre>
  
  <p>Can anyone point out something obvious that I'm doing wrong?</p>