Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    40
    Vote Rating
    0
    pkvenu is on a distinguished road

      0  

    Default Answered: Create a config file

    Answered: Create a config file


    Hi guys,

    can some one tell me how to create a config file so that i could use it across the application.

    In JavaScript i would create a file called config and

    Code:
    ar mapserviceUrl1 = "http://204.94.80.163/ArcGIS/rest/services/";
    var mapserviceUrl = "http://map1-2.lan.511.org/ArcGIS/rest/services/";
    //var localImageDir = mapImageDirectory;
    
    
    function mapConfig() { };
    var mapconfig = new mapConfig();
    //mapConfig.prototype.LocalImageDir = localImageDir;
    
    mapConfig.prototype.generalSettings = {
        defaultZoomLevel: 2, 
        defaultQueryTolerancePixels:2
    }
    
    mapConfig.prototype.generalSettings = {
        defaultZoomLevel: 2,
        defaultQueryTolerancePixels: 2
    };
    
    mapConfig.prototype.spatialReference = {
        parking: new esri.SpatialReference({ wkid: 4269 })
    };
    and then call mapconfig.generalSetting to get the general setting values in my application.

    How can i perform the same in sencha touch 2

    Regards,
    Paw

  2. You can still create a config file and include it as a <script> tag in your index.html file. The namespace won't be setup if you are wanting to use a namespace like in the MVC. If you are using MVC, I personally create a singleton that I require first...

    Code:
    Ext.define('MyApp.Config', {
        singleton : true,
    
        config : {
            urls : {
                users : 'users/get.php'
            }
        }
    });
    Above your Ext.application call you can then use Ext.require to load this file:

    Code:
    Ext.Loader.setPath('MyApp', 'app');
    
    Ext.require([
        'MyApp.Config'
    ]);
    Within your application classes you can get a url via:

    Code:
    MyApp.Config.getUrls().users

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