View Full Version : Dependencies are Out of Order

5 Mar 2012, 5:03 AM

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.

5 Mar 2012, 7:31 AM
I have had no issues with the order in my apps.

5 Mar 2012, 7:57 AM
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.


5 Mar 2012, 8:27 AM
In my app.js I did a simple require and everything in the order I wanted it.

enabled: true,
paths: {
'APP.arch': '.',
'Ext.ux.form': './js-4.0.7/plugin',
'Ext.ux': './js-4.0.7/plugin'
name: 'APP.arch',
appFolder: 'js-4.0.7/arch',
requires: [

When I do sencha build everything is placed in order with no issues.

5 Mar 2012, 8:34 AM
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.


5 Mar 2012, 10:21 AM

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.

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!

5 Mar 2012, 10:44 AM
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.

enabled: true,
paths: {
'APP.common': '.'
name: 'APP.common',
enableQuickTips: true,
appFolder: 'js-4.0.7/common',
controllers: [
config: {
myParam: undefined
launch: function() {
//TODO after everything is loaded

6 Mar 2012, 10:23 AM

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


6 Mar 2012, 6:43 PM
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.

12 Apr 2012, 6:58 AM
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.