PDA

View Full Version : Where does require look for files?



Oliver Specht
9 Nov 2012, 4:38 AM
Hi,
I wonder where the Ext.require function looks up the JS files to load?

Is searched the documentation, docs and forum but did not find any answer.

Can anyone help me out? Do I need to stick to the proposed app structure?

Thanks!

Oliver

vietits
9 Nov 2012, 4:56 AM
Ext.Loader will look for class files basing on the path of namespace that is set by using Ext.Loader.setPath(). You can also set path for namespaces by using Ext.Loader.setConfig().

Oliver Specht
9 Nov 2012, 8:09 AM
Does this require to have the standard app folder structure and only work for applications written in MVC architecture?

So, as an example, is it possible to define some folders where to look up scripts? Something like:

- app
- data
- ext
- myscripts

Thanks,
Oliver

vietits
9 Nov 2012, 3:41 PM
It is applied for all kind of applications basing on Ext framework.

suzuki1100nz
9 Nov 2012, 7:35 PM
Your java-script files and directory structure must follow the Sencha naming convention.
i.e. the class name matches the directory structure

e.g. MyApp.desktop.view.MainWindow

App path as defined with loader -> Desktop folder -> view folder -> Javscript file named MainWindow.js

Oliver Specht
12 Nov 2012, 2:11 AM
@suzuki:

Thanks! That is exactly the example that I needed to understand :)