I see that some of the examples included with ExtJS 4 start up via a single call to Ext.application()
. Other examples, however, 开发者_StackOverflow中文版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:
you'd normally use the convenient
Ext.application()
call for a full-screen (e.g., Viewport-based) app?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
, andonReady()
?
Thanks for the clarification!
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).
精彩评论