This might look like a dumb question but I am new to MVC particularly to extJs. I wish to work with the MVC approach. I followed this link http://www.extjsframework.com/mvc/simple-mvc-application. But it has only a single page as example. The example page uses app.js to load extjs views. Now here is my question. I have an application with multiple pages. Do i need to make separate app.js like scripts for each page of my app or could i use the same app.js accross all my pages. If i could, kindly mention how. Thanks...
4 Answers
All of the answers here are correct, however the question seems to be a bit ambiguous so that's why they are all slightly different.
The typical RIA app is a single HTML(or php,jsp,asp) page with many different views all managed by the the JS framework, so changing pages is no longer required (and in most cases avoided for performance reasons).
Your server side code/scripts are then typically reduced to JSON data services that provide data to the RIA app running completely independently in the client browser.
As you can see you would not need to have test.php and index.php and would suffice to have one index.php with ExtJS application running out of that page.
If this answer is not useful because you already knew all of this and really meant to ask about multiple controllers and modularization of an ExtJS application then that's a separate discussion and has been addressed to an extent in other posts. (look for lazy loading controllers).
Hope this helps.
The MVC concept of ExtJS 4 is about architecture. The documentation clarifies that pretty easily.
Every Ext JS 4 application starts with an instance of Application class. The Application contains global settings for your application (such as the app's name), as well as maintains references to all of the models, views and controllers used by the app. An Application also contains a launch function, which is run automatically when everything is loaded.B
As you can see in the docs, you will have one single app.js, that is gonna be like a bootstrap, responsible to instantiate the whole application.
You are gonna structure your files, however, following the MVC approach, or pattern, in order to have a nice and clean architecture.