0

I try to load a store, but for some reason I get this error in Google Chrome(latest version):

Uncaught TypeError: Cannot call method 'apply' of undefined ext-all-debug.js:8586
fire ext-all-debug.js:8586
Ext.define.continueFireEvent ext-all-debug.js:24623
Ext.define.fireEvent ext-all-debug.js:24601
Ext.define.onProxyLoad ext-all-debug.js:50186
Ext.define.processResponse ext-all-debug.js:39168
(anonymous function) ext-all-debug.js:39381
Ext.apply.callback ext-all-debug.js:6422
Ext.define.handleResponse ext-all-debug.js:18769
(anonymous function) ext-all-debug.js:1815
(anonymous function)

and this one in Internet Explorer 8:

Message: 'fireFn' is null or not an object

while FireFox(latest version) seems to ignore it.

I have inserted some new lines in ext-all-debug.js, so the line numbers may be off by 5-10 lines.

This is the store:

Ext.define("FI.store.units.InstallBaseStore", {
extend:'Ext.data.Store',
requires: "FI.model.units.InstallBaseModel",

            model: "FI.model.units.InstallBaseModel",
            storeId: 'installBaseStore',
            pageSize:10,
            proxy: {
                type: 'jsonp',
                url: urls.QSUrl+"/search",
                limitParam: 'undefined',
                startParam: 'offSet',
                pageParam: 'undefined',
                extraParams: {
                    searchString: '*:*',
                    index: "fleet",
                    role: "Admin"
                },

                 reader: {
                        root: 'results.results',
                        totalProperty: 'numFound',
                        model: 'FI.model.units.InstallBaseModel'
                    }
            },

            listeners:{
                beforeload: {
                    fn:function(){
                        console.log("BEFORE LOAD");
                        this.getProxy().setReader({
                        root: 'results.results',
                        totalProperty: 'numFound',
                        model: 'FI.model.units.InstallBaseModel'
                    });
                        console.log(this.getProxy().getReader());
                    }
                }
            }
        });

Any ideas?

5
  • 3
    If you are in Google Chrome you can tell it to pause execution when an error occurs by going to the Scripts tab and pressing the little stop sign until it turn blue (Pause on Exceptions). Then, when you run the program it will show precisely what line your error is in, you can inspect variables and run expressions on the command line and you can also move up and down the stack trace to see how things are going.
    – hugomg
    Jul 4, 2012 at 13:47
  • @missingno It's a nice feature, but it doesn't seem to help me very much... Do you happen to have any other ideas?
    – Dragos
    Jul 4, 2012 at 14:06
  • You probably just mistyped a variable somewhere and noone here will be able to guess where. Leveraging the debugger lets you find out where without having to run your program hundreds of times, manually adding tons of print statements.
    – hugomg
    Jul 4, 2012 at 16:15
  • 1
    1. why are you doing it like that? 2. you don't need to require your model as you are already declaring that you're using it 3. your proxy should actually go in your model, not your store. 4. does it work if you use a reader like in the examples? Jul 4, 2012 at 17:43
  • @NeilMcGuigan I added the require because I had some issues with the model at some point an I thought this might be a good practice. As for the proxy, I thought it made more sense to add it to the store(since in the documentation there is this option). As it turns out, this was actually my mistake, but I don't know why. Please post this as an answer so I can accept it. Would you kindly explain to me why was this approach wrong. Hopefully I will learn more this way(I'm new to ExtJS). Thank you a lot!
    – Dragos
    Jul 5, 2012 at 9:08

1 Answer 1

0

Put the proxy in the model, and do the reader like this:

...
proxy:{
  type:'ajax',
  url:'...',
  reader:{
    type:'json',
    root:'...'
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.