Threaded View

  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

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar