1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    3
    Vote Rating
    0
    PhilippD is on a distinguished road

      0  

    Default Unanswered: load proxy data in store

    Unanswered: load proxy data in store


    Hey guys,

    I am struggling with the loading of the data from a proxy in the store. To give you some code that is my main view
    Code:
    Ext.define('storeTest.view.Main', {    extend : 'Ext.form.Panel',
            xtype : 'testing',
            required: ['Ext.field.Text'],
            config : {
                fullscreen : true,
                items : [{
                            xtype : 'textfield',
                            label: 'User',
                            id: 'userField'
                        }, {
                            xtype : 'textfield',
                            label: 'Password',
                            id: 'passwordField'
                        }, {
                            xtype : 'textfield',
                            label: 'Gender',
                            id: 'genderField'
                        }
                        ],        	
            
          listeners: {
            		initialize: function(){
           			console.log('view initialize');
            			var test = Ext.getStore('testingstore');   	// get the Store
        				var instance = Ext.create('storeTest.model.testModel', {
    						user: '' , 
    						password : '', 
    						gender: ''
    					}); 
    					test.add(instance);
    					test.sync();
            		}
            	}
            	}
        });
    as too see i get my store if inspect the store with the DOM the data from my proxy is there but i can't access or read it. To read the store with the proxy data i need at first to add a model instance in the store (I think that is not the right way but it was the only way how i got it to work)

    My store looks so
    Code:
    Ext.define('storeTest.store.testStore', {    extend : "Ext.data.Store",
        requires : [ 'storeTest.model.testModel', 'Ext.field.Text' ],
        config : {
            storeId : 'testingstore',
            model : 'storeTest.model.testModel',
        	autoLoad: false,
        	//autoSync: true,
        proxy : {
                type : 'ajax',  //jsonp
                url : 'http://localhost:8080/RestPrototype/webresources/generic/getSmallJson',  
            	actionMethods: {
                        create: 'GET',
                        read: 'GET',
                        update: 'PUT',
                        destroy: 'DELETE'
                    },
                      
            	reader: {
                type: 'json',
                model: 'storeTest.model.testModel'
            }
            },
            
    	
    	listeners : {
    		write:function(){
    			var userField = Ext.getCmp('userField');
    			var passwordField = Ext.getCmp('passwordField');
    			var genderField = Ext.getCmp('genderField');
    			userField.setValue(this.getAt(0).data.user);  // We have our json data
    			passwordField.setValue(this.getAt(0).data.password);
    			genderField.setValue(this.getAt(0).data.gender);
    		}
    	}
    	}
    });
    I know that with the write event i can write something to the store but how can i write just the one data from the proxy without to create a fake model instance.

  2. #2
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    714
    Answers
    41
    Vote Rating
    42
    ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about

      0  

    Default


    Could you please explain your scenario, what do you want to achieve?

Thread Participants: 1

Tags for this Thread

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