1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    6
    Vote Rating
    0
    rsringeri is on a distinguished road

      0  

    Default How do you add requires section in Architect 2

    I can't seem to find a way to add the requires section to my app from Architect 2.

    Any pointer highly appreciated.
    thanks

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,485
    Vote Rating
    136
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    If you need to dynamically load additional classes, you can add a loader config to the application node and then configure the require on the Loader.
    Aaron Conran
    @aconran

  3. #3
    Sencha User
    Join Date
    Jan 2008
    Posts
    9
    Vote Rating
    0
    trak is on a distinguished road

      0  

    Default

    The loader doesn't have any require option. Could you be more clear on how to add the require to the loader? Looking at the docs, the require is a method of Loader not a Property, and Sencha Architect doesn't let you add method calls to the loader config. Does it have to be done inside a function on the application?

  4. #4
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    523
    Vote Rating
    42
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default

    Any answer/success with this? I need to add a requires section as well and I'm not seeing a clear path.

    Aaron, your explanation includes terminology that does not appear to be available via Architect.

    Thanks
    JB

  5. #5
    Ext JS Premium Member
    Join Date
    Sep 2010
    Posts
    439
    Vote Rating
    38
    stewardsencha will become famous soon enough stewardsencha will become famous soon enough

      0  

    Default

    Oh help.

    My understanding of "requires" is that it is only used during development, that the process of deployment (jsb3) resolves all the "requires". Sorta like compiling. You deploy the finished app.js --and it won't be loading anything dynamically, it will already have the required classes packaged in.

    The api just says "List of classes that have to be loaded before instantiating this class." Which defines the word (requires=has to be loaded first) but doesn't elaborate. The "getting started" guide and miscellaneous forum posts led me to the conclusion above.

    It simply makes sense to me, so I have been doing it. If nothing else, it helps documents the class.

    I set my loader paths dynamically. I don't have a static html page for my app, I am using a php cms system with those insane seo friendy urls to nowhere. I got tired of extjs thinking it has a different webroot, so I used window.location to get the url, then backed up until I hit the root, then prepended the appropriate number of "../" to all loader config paths.

    I supply an additional js file before the app. That has my loader config. And that is where I have been stuffing any requires.

    Now maybe SA is going to step in with an alternate deployment chain so "requires" won't be necessary?

    My own answer doesn't make sense to me. A large app needs to load controllers dynamically, and those controllers are going to have a ton of dependencies.

    If only I knew what it is I don't know, I could make some decisions and move forward !

    But I don't know how to translate what I have into SA unless I just drop all the requires.

  6. #6
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,402
    Vote Rating
    300
    ssamayoa can only hope to improve

      0  

    Default

    I'm currently testing an applicartion with dynamic class loading instead of having large monolitic app-all.js.

    Of course what I deploy to app server is compressed (with yuicompressor) js files.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  7. #7
    Sencha User Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953
    Vote Rating
    65
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      1  

    Default

    The ability to add custom requires to the application is coming soon!
    Phil Strong
    @philstrong

  8. #8
    Sencha User
    Join Date
    May 2010
    Posts
    12
    Vote Rating
    0
    eoliphan is on a distinguished road

      0  

    Default

    Umm, how then should one handle application 'globals' (e.g. base URL's for stores, etc) in Architect if we can't create a ..Config class and require it?

  9. #9
    Sencha User
    Join Date
    May 2011
    Posts
    25
    Vote Rating
    0
    invalidoyt is on a distinguished road

      0  

    Default

    You can use the "launch" function to define globals. This is how I do:

    Code:
    launch: function() {
            Admin.global = {
                HOME_CARD: 0,
                TOURS_CARD: 1,
                HOTELS_CARD: 2,
                ...
            };
        }

  10. #10
    Sencha Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    602
    Vote Rating
    31
    svenna has a spectacular aura about svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default

    In SourceDevCon in London I think Aaron or some of the other speakers added to the requires list of the application as part of his Sencha Architect talk, however I can't really find that option in the public 412 build.

    Specifically I want to require the device.* as shown on the screen.
    Sven Tore Iversen