PDA

View Full Version : The Loader Does Not Seem To Work Very Well



ekejma
12 Aug 2011, 1:15 PM
I'm starting with ExtJS and I don't want to include everything in the htm file because it degrades the Chrome Debugger performance to debug into such a large file ( ext-all ).

My application is using forms so I include just the core in my index.htm file and was hoping I could use the loader to load just the working set for my test application. Nope.

Like : Ext.require('Ext.form.field.*', function() { ... } )

or


Ext.require(['widget.*','layout.*','Ext.data.*']);
The Loader immediately calls the callback without loading anything. Then ExtJS blows up when the classes are not loaded.

Does anyone else find the Loader to be a total PTA ???

I crawled in the loader code and it took the wildcards and made no classes from them and just called the callback without loading anything. Nice...

So it looks like I can't develop with ExtJS unless i put their entire library in the head of my document. I don't want to make custom classes all the time. I just wanted to load the ext-core, and then have the Ext.require(...) mechanism work. To my astonishment, I guess the Loader doesn't really handle that situation. Am I right aboout this ? Do you really have to make custom classes , why doesn't Ext.require(...) work ?

To get around this I load ext-all, and suffer the Chrome debugger struggling with megabytes of ExtJS sources that I"m not using, because I can't get the Loader to work.

I really wanted to use wildcards, since listing all the files I"m using would be horrible.

What am I missing here ?

By the way I tried the example on the Loader documentation and the class translation fails and it does not load anything ???

:(( ( I like ExtJS - but so far I hate that Loader , the YUI Loader just works, this one just goes dark, what gives ? )
A loader should be simple to use, and just work.

peace
mark

mitchellsimoens
13 Aug 2011, 9:23 AM
Even though the docs say that you can use Ext.require with "widget.*" and "layout.*" I have doubts. From the source, it seems that you are required to specify class names like Ext.panel.Panel or Ext.panel.*. I don't see how Ext.ClassManager can know about the alias if the class hasn't been loaded.

stevil
17 Aug 2011, 11:44 AM
Even though the docs say that you can use Ext.require with "widget.*" and "layout.*" I have doubts. From the source, it seems that you are required to specify class names like Ext.panel.Panel or Ext.panel.*. I don't see how Ext.ClassManager can know about the alias if the class hasn't been loaded.

This topic has definitely been a recurring one - I know Jacky Nguyen mentioned that one future plan was for a more unified class factory that would somehow take this into account...

But +1 - unless you pre-declare the alias, Ext.require will be unable to load by it.

stevil

zombeerose
17 Aug 2011, 1:14 PM
Since I use almost everything in Ext, this is what I do...



Ext.Loader.require(['Ext.*'], function(){
//callback for stuff
},this,[
//list of excludes
'Ext.direct.*'
,'Ext.draw.*'
,'Ext.flash.*'
,'Ext.grid.feature.GroupingSummary'
,'Ext.selection.CheckboxModel'
,'Ext.state.LocalStorageProvider'
//etc...
]


You didn't list your Loader setup so just to be thorough...


Ext.Loader.setConfig({
disableCaching: true
,enabled: true
,paths: {
'Ext': '/includes/library/extjs/ext/src' // <-- required since Ext 4.0.2
//etc...
}
});