PDA

View Full Version : Loader Confusion



JakeL
8 Mar 2012, 12:38 PM
Hi all -

I'm trying to get get started with ExtJS in an existing web app. I believe I'm having trouble getting Ext.Loader working correctly.

I've set up a grid, which is working well. However, when I try to set up the loader to load the Ext.ux.grid.FiltersFeature and associated files for enabling the filter feature, things begin failing.

To try and simplify, I enabled the loader, and tried to require just Ext.grid.* and Ext.data.*, without even dinking with the filter thing. Basically, as soon as I enable the loader, the grid cannot load successfully, despite the fact I'm referencing ext-all-debug.js

I am wondering if it is related to the existing directory structure in the app.

directory structure:


/
apps/
default.aspx <-- file that I am dealing with
extjs/


My loader code looks like so. My attempt was to tell the loader it needs to look for extjs in root, rather than as a subdirectory of the current HTML/ASP file.



Ext.Loader.setConfig({ enabled: true });
alert("setting path..");
//Ext.Loader.setPath('Ext.ux', '../extjs/examples/ux');
Ext.Loader.setPath("Ext", "/");
Ext.require(
[
'Ext.grid.*',
'Ext.data.*'
//'Ext.ux.grid.FiltersFeature',
//'Ext.ux.grid.menu.ListMenu',
//'Ext.ux.grid.menu.RangeMenu',
//'Ext.ux.grid.filter.BooleanFilter',
//'Ext.ux.grid.filter.DateFilter',
//'Ext.ux.grid.filter.ListFilter',
//'Ext.ux.grid.filter.NumericFilter',
//'Ext.ux.grid.filter.StringFilter'
]);



Thoughts? Have made no progress all day today!

Thanks,

-Jake

vietits
8 Mar 2012, 3:20 PM
Wildcard '*' only applied for classes written by Sencha, it is not applied for custom classes even Ext.ux.*. So fix your code to include the extension classes you use.


Ext.Loader.setConfig({ enabled: true });
alert("setting path..");
Ext.Loader.setPath('Ext.ux', '../extjs/examples/ux');
Ext.Loader.setPath("Ext", "/");
Ext.require(
[
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.grid.FiltersFeature' // you need to require this class, the other classes below will be required by this class
//'Ext.ux.grid.menu.ListMenu',
//'Ext.ux.grid.menu.RangeMenu',
//'Ext.ux.grid.filter.BooleanFilter',
//'Ext.ux.grid.filter.DateFilter',
//'Ext.ux.grid.filter.ListFilter',
//'Ext.ux.grid.filter.NumericFilter',
//'Ext.ux.grid.filter.StringFilter'
]);

JakeL
10 Mar 2012, 7:18 AM
Thank you!

Was able to get it working by just require'ing the specifici class, as you said.

Cheers!

-J

vietits
10 Mar 2012, 3:49 PM
With Ext.ux.grid.FiltersFeature class you only need to set path for namespace 'Ext.ux' and require this class only. The other classes used by this class will be automatically loaded.