Hybrid View

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
    KrasimirTsonev is on a distinguished road

      0  

    Default Uncaught TypeError: Cannot call method 'on' of undefined

    Uncaught TypeError: Cannot call method 'on' of undefined


    Hello,

    I'm using Ext Designer 1.2.2 with Ext JS 3. I successfully export the project, but when I try to run it I receive:
    Code:
    Uncaught TypeError: Cannot call method 'on' of undefined
    I dig a little into the generated code and here is what I found:
    The problem is in the following code:
    Code:
    store = Ext.StoreMgr.lookup(store);
                store.on({
                    scope: this,
                    beforeload: this.beforeLoad,
                    load: this.onLoad,
                    exception: this.onLoadError
                });
    I.e. here "store" returned by the StoreMgr is not defined and of course we can't access its method "on". It is not defined because it is missing in StoreMgr. So, I started to search where we add things inside the StoreMgr and found that this is happening in the constructor of Ext.data.Store by using
    Code:
    Ext.StoreMgr.register(this);
    So far so good ... it is clear for me that once the "store" is created register itself in that store manager. I simply put a console.log in the very first line of the constructor of the store and that log never occur. It looks like there is no any initial store creation. In other words I need a "store" object before it is created.
    In my case I have a PagingToolbar with a store set and when that component needs it the store is still not created.

    So, my questions is: can you give me any advice how to fix the problem or just any direction of the Stores' things. I.e. how are they created, initialized etc ...

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
    KrasimirTsonev is on a distinguished road

      0  

    Default


    However I changed this line of code:
    Code:
    return Ext.isObject(id) ? (id.events ? id : Ext.create(id, 'store')) : this.get(id);
    to
    Code:
    if(Ext.isObject(id)) {
        return (id.events ? id : Ext.create(id, 'store'));
    } else {
        var store = null;
        if(store = this.get(id)) {
            return store;
        } else {
            return Ext.create(id, 'store');
        }
    }
    This little fix created the stores, but they were empty. I.e. the information which I entered by using the designer was missing. And at the end I notice that the stores are actually created in xds_index.js and because we have a custom index.js that logic wasn't trasnfered. Once I copied the lines the app runs successfully.

    Hope that this helps to someone

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar