PDA

View Full Version : using "new" or Ext.createWidget



gevik
16 Feb 2011, 2:47 PM
Hi,

In the examples, the Ext.creatdWidget method is used instead of the "new" keyword. Is this the way to go forward?

I understand that ClassManager->instantiateByAlias internally will load the required classes and signal for ready. But, is Ext.creatdWidget also appropriate for production environments? Especially when ext-all.js will be included in the page?

Regards,
Gevik

Jacky Nguyen
16 Feb 2011, 10:35 PM
There are many benefits of using Ext.widget() (Ext.createWidget() will be deprecated in the next release) that we will be revealing through in-depth tutorials in the coming weeks. Beside the convenience of instantiating by xtype (no need to remember the full class name), it enables dynamic dependency resolution behind-the-scene to ensure the corresponding class is loaded the first time it's instantiated.

Again we decided to delay introduction of Ext.Loader until the next release, so that we have more time to prepare good documentation. Stay tuned ;)

TommyMaintz
17 Feb 2011, 3:24 AM
To answer your question in short, yes, it would be better to use Ext.widget instead of new Widget going forward. There will be more benefits in the long term then just enabling dynamic loading.