Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When would you us Ext.application() vs. Ext.Loader.setConfig, .require, and .onReady?

Tags:

extjs4

I see that some of the examples included with ExtJS 4 start up via a single call to Ext.application(). Other examples, however, manually call Ext.Loader.setConfig(), Ext.require(), and Ext.onReady() instead. I want to make sure I understand the difference.

Am I correct in assuming that:

  1. you'd normally use the convenient Ext.application() call for a full-screen (e.g., Viewport-based) app?

  2. if you just want to use a few ExtJS components on a pre-existing "non-Ext" page you'd opt for the manual calls to Ext.Loader, require, and onReady()?

Thanks for the clarification!

like image 580
Clint Harris Avatar asked Jun 01 '11 13:06

Clint Harris


People also ask

What is use of ext onReady () function?

Ext. onReady() means wait til the DOM is ready and all required classes are loaded.

What is Ext loader?

Files. Loader.js. Ext.Loader is the heart of the new dynamic dependency loading capability in Ext JS 4+. It is most commonly used via the Ext.require shorthand. Ext.Loader supports both asynchronous and synchronous loading approaches, and leverage their advantages for the best development flow.

What is requires Extjs?

Requires - All classes required to be defined for the class to be instantiated. Uses - A list of classes potentially used by the class at some point in its lifecycle, but not necessarily requried for the class to initially be instantiated. Subclasses - Classes that extend the current class.


1 Answers

The full application call is used for the Ext MVC approach, and comes with a set of conventions to pre-load additional components, for example the stores and views options in the controller classes. For a better explanation see the Ext documentation on MVC.

If you just need to throw a few components on the page, as you state, you will get better performance just using the loader, or better, avoiding dynamic loading (at least in production).

like image 73
Simon Elliston Ball Avatar answered Nov 17 '22 00:11

Simon Elliston Ball