Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    8
    Vote Rating
    0
    priya@ceptes.com is on a distinguished road

      0  

    Default Unanswered: How to save ajax proxy store data in localproxy

    Unanswered: How to save ajax proxy store data in localproxy


    Need some help to save Ext.Store data in localstorage which connects to extrenal system (using rest webservice api).

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    shakilbharucha is on a distinguished road

      0  

    Default


    you will need to download the data into the ajax store and then move the same into the offline store once the the online store is loaded

    In the example below the inv.models.NewsData is my model and should me a model for both online and offline store.

    Also your component should point to the the offlineStore.

    Code:
    inv.stores.NewsData = new Ext.data.Store({
        model: 'inv.models.NewsData',
        proxy: {
            type: 'scripttag',
            url: 'http://query.yahooapis.com/v1/public/yql',
            extraParams: {            format: 'json'        },
              reader: {
                  root: 'query.results.Results.RNSSummaries.RNSSummary'
              }
          }});
    
    this.offlineStore= new Ext.data.Store({
                  model: 'inv.models.NewsData',
                  proxy: new Ext.data.LocalStorageProxy({
                      id:'data', 
                     proxy:{idProperty:'RNSId'}
                  }), 
                 autoLoad: true,
                  autoSave: true 
             });
    
    this.inv.stores.NewsData.on('load',function(store,records,opts){
                      console.log("load from online"); 
                     this.offlineStore.proxy.clear(); 
                     this.inv.stores.NewsData.each(function (record){
                          var iconEach = this.offlineStore.add(record.data)[0];
                      },this);
                      this.offlineStore.sync();
                      console.log("loaded from online");
                 },this);

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar