Sorry, the answer that follows is based on the misunderstanding that you are asking me if having the "view: creates the store" is the correct way of doing things as far as the "stores" array is concerned.
Originally Posted by danielleng
The answer to the question you are actually asking (I hope) is given in a later post.
I offer no guarantees as I am also a beginner, but it appears from the available documentation (see below) that it is correct and that other variations would also be correct.
It appears that the correct way is:
I have come across this sample code which illustrates another approach.
- that it makes sense
- and that it loads the files before they are needed.
models: ['Station', 'Song'],
stores: ['Stations', 'RecentSongs', 'SearchResults'],
controllers: ['Station', 'Song']
I have not yet determined if I can put the arrays multiple times without impact (i.e the application already knows that those files are loaded when it encounters them again).
The official documentation "MVC Architecture" found at
with its code sample available under the Ext JS 4 SDK download, inside the "examples/app/simple folder";
shows the "stores array" under the "controllers array" as well.
As a matter of fact, the "Ext.app.Application" documentation at
puts the "models array" in the "app.js" file with the "controllers array".
It also states
In its section "Telling Application about the rest of the app" it states their purpose and benefits.
Because we told our Application about our Models and Controllers, and our Controllers about their Views, Ext JS will automatically load all of our app files for us
. This means we don't have to manually add script tags into our html files
whenever we add a new class, but more importantly it enables us to create a minimized build of our entire application
using the Ext JS 4 SDK Tools.
As a beginner I found the following confusing as I tried figuring out the architecture.
Note that we didn't actually list the Views directly in the Application itself (app.js). This is because Views are managed by Controllers, so it makes sense
to keep those dependencies there.
We have been talking about 4 arrays called
the controllers array, Please note that the names are plural.
the views array,
the models array
and the stores array.
The singular "store" is a configuration element to identify the store used by a view.
The singular "model" is a configuration element to identify the model used by a store.
I have not yet been able to distinguish clearly the difference, if any, between the "requires array" and the other 4 above.
The article "Using Ext Loader for Your Application" at
still leaves me confused about the differences.
I hope this has been of help to you.