1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Exclamation Unanswered: Ext.clone a store

    Unanswered: Ext.clone a store


    i have a store_A and i want to have one more, similar to this (model,proxy) but loaded independent.

    when i do it like : (ExtJS 4.07)
    Code:
    store_B = Ext.clone(store_A);
    and then :
    Code:
    store_A.load();
    store_B.removeAll();
    ... both are empty in the end (like they were one object - but documentation says reference should be dropped by Ext.clone.. )

    Is it a bug? or am i doing something wrong?

    Is it obligatory to define whole new store separately just for having 2 data sets of same model and source?

    PS. following makes no difference.
    Code:
    var store_B = Ext.apply({},store_A);

  2. #2
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Wink way around

    way around


    to achieve store cloning i use function similar to following:

    Code:
    clone = function(dict){
    	return Ext.create(dict.$className,{
    		proxy:{
    			url:dict.proxy.url,
    			type: 'ajax',
    			extraParams:dict.proxy.extraParams,
    			simpleSortMode : true,
    			reader: {
    				type: 'json',
    				root: 'rows',
    				totalProperty:'total',
    				successProperty: 'success',
    				idProperty:dict.proxy.reader.idProperty
    			}
    		}
    	});
    }

  3. #3
    Sencha User chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    203
    Answers
    42
    Vote Rating
    10
    chramer will become famous soon enough

      0  

    Default


    or maybe just :
    Code:
    Ext.define('definedStore', {...});
    storeA = Ext.create('definedStore');
    storeB = Ext.create('definedStore');

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Answers
    453
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Clone is only intended to be used on "primitive" type objects, data stores have a whole bunch of complexity that mean they can't really be cloned in a generic manner.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Default


    @chramer
    actualy i have one generic store class for all combos. then i create instances of particular lists only chainging proxy extra params.

    so i need a copy of already created store because :
    - i dont want to rewrite each proxy by hand
    - and also i dont want to have 200 separate store class definitions.(for readability sake)

    going Your way leads to deifining 200 classes only differing with one extraParam (wile i need just one). Plus 300 instantiations.

    The other way is like 1 class definition. Plus 200 instantiations. Plus 100 cloning.

Thread Participants: 2

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