1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    32
    Vote Rating
    1
    rhapsodyv is on a distinguished road

      0  

    Question Dependencies are Out of Order

    Dependencies are Out of Order


    Hi,

    This is a strange thing. Maybe I'm doing something wrong.
    My all-classes looks like this (in this order):

    Ext.define('MyApp.foo.bar', {
    extend: 'Ext.tree.Panel',
    ....

    Ext.define('Ext.tree.Panel', {
    extend: 'Ext.panel.Table',
    ...

    The tree.Panel was included after some classes that use it. So, when I open my app, it will load all stuff of tree.Panel to meet the MyApp.foo.bar requirements.

    I'm using SDK 2.0- Developer preview.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Vote Rating
    859
    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


    I have had no issues with the order in my apps.
    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
    Dec 2011
    Posts
    32
    Vote Rating
    1
    rhapsodyv is on a distinguished road

      0  

    Default


    Hum.
    I will try figure out what I'm doing wrong...
    How SDK works? Do It handle 'extend', 'require' and Ext.create?

    Do I need require all ext classes that I use?
    Maybe I can't use Ext.Loader in development to have the right generated jsb3.

    Thanks.

  4. #4
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    In my app.js I did a simple require and everything in the order I wanted it.

    PHP Code:
    Ext.Loader.setConfig({
        
    enabledtrue,
        
    paths: {
            
    'APP.arch''.',
            
    'Ext.ux.form''./js-4.0.7/plugin',
            
    'Ext.ux''./js-4.0.7/plugin'
        
    }
    });
    Ext.application({
        
    name'APP.arch',
        
    appFolder'js-4.0.7/arch',
        
    requires: [
            
    'APP.arch.Ajax',
            
    'APP.arch.Submit',
            
    'APP.arch.Grid',
            
    'APP.arch.Paging',
            
    'APP.arch.PingTask',
            
    'APP.arch.Panel',
            
    'APP.arch.Form',
            
    'APP.arch.TabPanel',
            
    'APP.arch.FieldSet',
            
    'APP.arch.Combo',
            
    'APP.arch.Container',
            
    'APP.arch.TimeField',
            
    'APP.arch.Checkbox',
            
    'APP.arch.Radio',
            
    'APP.arch.NumberField',
            
    'APP.arch.MoneyField',
            
    'APP.arch.TextArea',
            
    'APP.arch.TriggerField',
            
    'APP.arch.TreePanel',
            
    'APP.arch.TextField',
            
    'APP.arch.Format',
            
    'APP.arch.DateField',
            
    'APP.arch.Printer',
            
    'APP.arch.DateHelper',
            
    'APP.arch.MultiFieldTime',
            
    'APP.arch.MultiFieldDate',
            
    'APP.arch.DateMenu',
            
    'APP.arch.DatePicker',
            
    'APP.arch.PhoneField',
            
    'Ext.ux.form.InputTextMask',
            
    'Ext.ux.RowExpander',
            
    'Ext.ux.TemplateRowExpander',
            
    'APP.arch.DateFilter',
            
    'APP.arch.Button',
            
    'APP.arch.LoadingButton'
        
    ]
    }); 
    When I do sencha build everything is placed in order with no issues.

  5. #5
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    The reason for the js-4.0.7 folder is we are upgrading projects from 3.1.1 to 3.4 to 4.0.7 then to 4.1 when it comes available.

    It made it easier for us to manage every Ext JS version we needed based off our architecture.
    Also made upgrading a breeze following the same structure.

    We have the following directories below in 1 location.

    ext-4.0.7/ext-all.js
    js-4.0.7/app.js
    resources-4.0.7/css/mytheme.css
    resources-4.0.7/images/myimage.jpg

  6. #6
    Sencha User
    Join Date
    Dec 2011
    Posts
    32
    Vote Rating
    1
    rhapsodyv is on a distinguished road

      0  

    Question


    Hi,

    Thanks for the help. But I think I found something.


    Looking for the code of Sencha SDK I discovered that it use Ext.Loader.history to get the files of the project.
    PHP Code:
       Ext.onReady(function() {            Ext.Loader.history.forEach(function(item) { 

    But I have a doubt:
    There are lots of callbacks listening on Ext.onReady. There some on my app, there one in Ext.Application that initializes the controllers, and so on.
    How is guaranteed that the Sencha SDK callback will be called by last?
    For example, if the Sencha SDK callback was called before the application onReady callback, the controllers and views won't be loaded, then lots of dependencies won't be loaded too.


    Seems that Ext.Loader.history will have only the files loaded until it's onReady callback is called. Is that right? Do I miss something?

    To solve this, do I need explicit require all my app classes (controllers, views, models, ...)?

    Thanks again!

  7. #7
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    I only gave an example of our arch-app.js.
    We also have a common-app.js which has controllers/models/views in it.
    We then have what we call a zone-app.js.
    We added functionality to the Ext.app.Application and Ext.app.Controller just so you know to get this to work correctly.

    Mitchell Simoens has a good example of multiple applications/controllers on his github. https://github.com/mitchellsimoens/SubAppDemo

    I do the requires in the arch-app.js to load first for the common-app.js.
    In the common-app.js I do my controllers/models/views in order that i want them to load.

    PHP Code:
    Ext.Loader.setConfig({
        
    enabledtrue,
        
    paths: {
            
    'APP.common''.'
        
    }
    });
    Ext.application({
        
    name'APP.common',
        
    enableQuickTipstrue,
        
    appFolder'js-4.0.7/common',
        
    controllers: [
                      
    'APP.common.controller.MainClientController',
                      
    'APP.common.controller.TestScreenController'
        
    ],
        
    config: {
            
    myParamundefined
        
    },
        
    launch: function() {
            
    //TODO after everything is loaded   
        
    }
    }); 

  8. #8
    Sencha User
    Join Date
    Dec 2011
    Posts
    32
    Vote Rating
    1
    rhapsodyv is on a distinguished road

      0  

    Question


    Ok.

    I've made all requires. But if I require my controllers, the App doesn't launch!
    Ext.app.Application:constructor requires the controllers and waits for the load in a onReady callback, but it is never called when the controllers was already loaded.


    I think I'm close... :-p

    Thanks.

  9. #9
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    577
    Vote Rating
    32
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    If you look at my common i have no requires but controllers listed instead.
    And it loads everything.
    I do models and views inside the controllers.

    Only do the requires if your extending a component like we are.
    Or if a model/view needs certain components to function.

  10. #10
    Sencha User
    Join Date
    Mar 2012
    Posts
    12
    Vote Rating
    1
    bax1989 is on a distinguished road

      0  

    Default


    Even if I declare them with a requires property inside the object passed to Ext.application method it does not add them to the build descriptor. The generated build descriptor contains only 2 of my classes and not all Ext classes needed.