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

      0  

    Default Unanswered: proxy parameters - dynamic at startup, and dynamic from user

    Unanswered: proxy parameters - dynamic at startup, and dynamic from user


    I am in the early stages of an app that will be, I think, fairly straightforward representation and occasional update of an existing, unmodifiable RESTful JSON database. I am struggling with a couple things, at this moment most noticeably the store proxy, and a couple of dynamic parameters that are needed.

    First, the basic code:
    Code:
    Ext.define('TouchMill.store.Tournaments', {
        extend: 'Ext.data.Store',
        config: {
            model: 'TouchMill.model.Tournament',
            autoLoad: false,
    
    
            proxy: {
                type: 'ajax',
                //url: 'test/data/tournaments.json',      // will change once dynamic
                url: 'https://api.leaguevine.com/v1/tournaments/',
    
    
                reader: { type: 'json', rootProperty: 'objects', },
    
    
                extraParams: {
                    access_token: 'TOKEN',
                    tournament_ids: '[18091,18093,18094]',  // XXX need to put this into a config opt
                },
            }
    
        }
    });
    In this case, I need to dynamically modify 2 things.
    • config.proxy.url: the particular html file that's loaded sets a global variable, based on which I choose the URL
    • config.proxy.extraParams.access_token: that comes from the login step (or localStorage, if already logged in), meaning that the app is already launched
    So, how do I correctly, from another file (app.js, or controller.Main) update these? And secondly, how do I defer loading until the right time? Setting autoload: false merely gave me a blank page instead of actually loading when I wanted.

    And the update question could be more specific -- it boils down to this: where can I learn how to access and update things from other locations? Is there something documenting how to access app elements from other scopes?

    Thanks!

    ben

    PS - tips on where in tutorials/vids/docs to find this would be awesome. I've watched several, looked at a few examples, and not found it so far...
    Last edited by benomatic42; 12 May 2013 at 6:58 AM. Reason: PS

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


    Is this store created through the stores config in Ext.application? Also, how are you getting the info for the url and extraParams?
    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
    Apr 2013
    Posts
    7
    Vote Rating
    0
    benomatic42 is on a distinguished road

      0  

    Default


    The store is created thusly:

    Code:
    Ext.application({
        name: 'TouchMill',
    
        models: [ 'Event', 'Tournament', ], //'TournamentTeam' ],
        views: [ 'Main', 'Events', 'Tournaments', 'Games', 'GameView', 'DevConfig', ],
        controllers: [ 'Main', ],
        stores: [ 'Events', 'Tournaments', ],
        ...
    });
    The URL info is statically defined, but depends on which html file is loaded. (ie, the html has a single global variable defined in the javascript, and I switch based on that.)

    The other extraParam comes via the login redirect and gets stored in localStorage.

    Thanks,

    ben

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..."