1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    Rui Marinho is on a distinguished road

      0  

    Default Unanswered: LocalStorage Sync problem Sencha 2

    Unanswered: LocalStorage Sync problem Sencha 2


    Hello, i am trying to load a store via jsonp, and then take that records on load event and copy and save it to local store, i see the file via dev tools on crhome getting created but the value is always null.
    I m reading a simple rss feed in json. it works well, and i can see that storeLocal all get's the items, it just doesn't save the value , only the key for the store.
    I m using the latest bits.

    Code:
      onStoreTopLoad :function(s, records, successful, operation,eOpts ){		var proxy = s.getProxy();
    		if(proxy.config.type =="jsonp" )
    		{
    			var storeLocal = Ext.create('Ext.data.Store', {
    		 							model: "Something.model.Post",
    		 							proxy: {
    		 								type: 'localstorage',
    		 								id : proxy.getUrl(),
    		 								reader: {
    		 									type: 'json',
    		 									rootProperty: 'posts'
    		 								}
    		 							}
    		 
    		 						});
    
    
    			storeLocal.add(records);
    			storeLocal.sync();
    		}
    	
    			
    	},

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    First off you need to remove the reader config altogether. It will always use just a plain JSON reader.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    Rui Marinho is on a distinguished road

      0  

    Default


    tryed that, din't work.. the value is null, but the key is created.

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    Rui Marinho is on a distinguished road

      0  

    Default


    ok i think maybe i know what's going on.. my model is like this ??? associations aren't not working?



    Code:
    Ext.define('attachment', {
        extend: 'Ext.data.Model',
        config: {
            fields: [
                { name: 'id', type: 'string' },
                { name: 'url', type: 'string' },
                { name: 'title', type: 'string' },
                 { name: 'description', type: 'string' },
                  { name: 'caption', type: 'string' }
            ]
        }
    });
    
    
    Ext.define('custom_field', {
        extend: 'Ext.data.Model',
        config: {
            fields: [
               { name: 'posicao', type: 'string' },
                { name: 'morada', type: 'string' },
                { name: 'localizacao_gps', type: 'string' },
                   { name: 'telefone', type: 'string' },
                      { name: 'horario', type: 'string' },
                         { name: 'linguas', type: 'string' },
    
    
                { name: 'foto', type: 'string' }
            ]
        }
    });
    
    
    
    
    
    
    Ext.define('Restaurantes.model.Post', {
        extend: 'Ext.data.Model',
            config: {
          			fields: ['title', 'link', 'author', 'contentSnippet', 'content'],
            		hasMany:[ {
                				model: 'custom_field',
                				name : 'custom_fields'
            				  },
    						  {
                				model: 'attachment',
                				name : 'attachments'
                			  }
    						]
        			}
    });
    Last edited by mitchellsimoens; 20 Mar 2012 at 4:46 AM. Reason: added [CODE] tags

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Associations will not be saved into localstorage or sent with any proxy.

    I have also wrapped your code in the [CODE] tags.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi