1. #1
    Ext User mrileyaz's Avatar
    Join Date
    Feb 2008
    Location
    Phoenix, AZ
    Posts
    19
    Vote Rating
    0
    mrileyaz is on a distinguished road

      0  

    Question Transfer data from one store to another store

    Transfer data from one store to another store


    I have a FormPanel. This form triggers a JsonStore to get data from the database. The store populates a second store. The second store populates a GridPanel. Each time the form is submitted, I need the data from the first store to be added (appended) into the second store, not replace it. Currently when I refresh the grid, the resultset from the second query replaces the first.

    Is there a public method for one of these objects I do not know about?

    Code samples follow:


    The form triggers this store. Assume baseParams maps to: form.getForm().getValues()

    PHP Code:
      var dsUsersProxy = new Ext.data.JsonStore({
          
    url'./?event=ajax.groupMempers.do',
                  
    baseParamsbaseParams,
                  
    autoLoadtrue,
          
    root'data',
          
    fields: ['displayvalue''rowid']
      }); 
    This is the second store. Assume JReader maps to a JsonReader which has a Record.create().

    PHP Code:
      var dsUsers = new Ext.data.Store({
                  
    readerJReader
      
    }); 
    This loads the data from the first store into the second store. This is where the problem is. I have used add() and insert() and both replace the existing data. There is no JS error but the data is overwritten. I have verified this with console.dir(dsUsers)

    PHP Code:
      dsUsersProxy.on('load', function(){
                  var 
    userRecords dsUsersProxy.getRange();
                  
    //dsUsers.add(userRecords);
                  
    dsUsers.insert(0userRecords);
                  
    console.log(dsUsers.data.length);
      }); 

  2. #2
    Ext User mrileyaz's Avatar
    Join Date
    Feb 2008
    Location
    Phoenix, AZ
    Posts
    19
    Vote Rating
    0
    mrileyaz is on a distinguished road

      0  

    Exclamation Wrong Forum

    Wrong Forum


    Sorry, this was supposed to go in Ext Community Forums (2.0). I will re-post there.

  3. #3
    Ext JS Premium Member Foggy's Avatar
    Join Date
    Apr 2007
    Location
    Switzerland
    Posts
    477
    Vote Rating
    0
    Foggy is on a distinguished road

      0  

    Default


    While this solution is not perfect, it just work

    Code:
    	prepareData : function(selections) {
    		var data = new Array();
    		
    		Ext.each(selections, function(record) {
    			var to = {
    				advice : record.data.advice,
    				name : record.data.name
    			}
    			data.push(to);
    		}.createDelegate(this));
    		
    		
    		var o = {
    			totalCount : selections.length,
    			data : data
    		}
    		
    
    
    
    		// damn im stupid, this should work too instead the lines above...
    		var o = {
    			totalCount : selections.length,
    			data : selections
    		}	
    
    
    		this.ds = new Ext.data.JsonStore({
    			root: 'data',
    			fields: [
    				'advice', 
    				'name'
    			],
    			sortInfo:{field: 'name'}
    		});
    		this.ds.loadData(o);					
    	},
    
    	init : function() {
    		this.prepareData(otherGrid.selModel.getSelections());
    	}

  4. #4
    Ext User cerad's Avatar
    Join Date
    Dec 2007
    Posts
    226
    Vote Rating
    0
    cerad is on a distinguished road

      0  

    Default


    dsUsers.insert(dsUsers.getCount(), userRecords);

  5. #5
    Ext User mrileyaz's Avatar
    Join Date
    Feb 2008
    Location
    Phoenix, AZ
    Posts
    19
    Vote Rating
    0
    mrileyaz is on a distinguished road

      0  

    Default


    2.0 thread can be found here:
    http://extjs.com/forum/showthread.php?p=138082

Thread Participants: 2

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