1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    testmacher is on a distinguished road

      0  

    Question Answered: Extend a Ext.data.Store and change some Parameters

    Answered: Extend a Ext.data.Store and change some Parameters


    Hello,

    I have 8 stores like this in my App:

    PHP Code:
    HR.stores.ConfigStore = new Ext.data.Store({
        
    autoLoad false,
        
    model 'Config',
        
    proxy: {
            
    type'scripttag',
            
    url'xxx.php',
            
    callbackKey'callback',
            
    extraParams: {
                
    method 'config'
            
    },
            
    reader: {
                
    type'json',
                
    root'results'
            
    }
        }
    }); 
    The only thing that makes the difference in these stores are the models an extraParams of the proxy.

    Is it impossible to create a MainStore like this
    PHP Code:
    HR.stores.MainStore = new Ext.data.Store({
        
    autoLoad false,
        
    proxy: {
            
    type'scripttag',
            
    url'xxx.php',
            
    callbackKey'callback',
            
    reader: {
                
    type'json',
                
    root'results'
            
    }
        }
    }); 
    and then extend this store several times and applying the mentioned differences?

    I already tried some things I found here:
    PHP Code:
    HR.stores.ConfigStore Ext.extend(HR.stores.MainStore, {
        
    constructor:function (config) {
            
    config config || {};

            
    Ext.applyIf(config, {
                
    model:'Config',
                
    proxy:{
                    
    extraParams:{
                        
    method:'config'
                    
    }
                }
            });

            
    HR.stores.ConfigStore.superclass.constructor.call(thisconfig);
        }
    }); 
    But I get errors like "Cannot read property 'proxy' of undefined"...

    How has the extended store to look like?

    Regards,

    testmacher

  2. Code:
    MainStore = Ext.extend(Ext.data.Store, {
        constructor : function(config) {
            config = config || {};
    
            var extraParams = config.extraParams || this.extraParams;
    
            Ext.applyIf(config, {
                model : 'Config',
                proxy : {
                    extraParams : extraParams
                }
            });
    
            MainStore.superclass.constructor.call(this, config);
        }
    });
    Code:
    UserStore = Ext.extend(MainStore, {
        constructor : function(config) {
            this.extraParams = {
                foo : 'bar'
            };
    
            UserStore.superclass.constructor.call(this, config);
        }
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Answers
    3466
    Vote Rating
    834
    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


    Code:
    MainStore = Ext.extend(Ext.data.Store, {
        constructor : function(config) {
            config = config || {};
    
            var extraParams = config.extraParams || this.extraParams;
    
            Ext.applyIf(config, {
                model : 'Config',
                proxy : {
                    extraParams : extraParams
                }
            });
    
            MainStore.superclass.constructor.call(this, config);
        }
    });
    Code:
    UserStore = Ext.extend(MainStore, {
        constructor : function(config) {
            this.extraParams = {
                foo : 'bar'
            };
    
            UserStore.superclass.constructor.call(this, config);
        }
    });
    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.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    testmacher is on a distinguished road

      0  

    Question


    Hello,

    thanks for the answer, but one problem remains if I do like this.
    I get:

    PHP Code:
    Uncaught TypeErrorObject function (config) {
            
    this.extraParams = {
                
    foo 'bar'
            
    };
            
    ConfigStore.superclass.constructor.call(thisconfig);
        } 
    has no method 'load' 
    if I try to 'load' the store (the ConfigStore).

    I also register like that:

    PHP Code:
    Ext.regStore('app_configStore'ConfigStore); 
    What do I have to change there? Must the MainStore also be registered?

    Regards,

    testmacher

  5. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    testmacher is on a distinguished road

      0  

    Default


    anyone?

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