1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    2
    Vote Rating
    0
    coolstr is on a distinguished road

      0  

    Question localstorage: Uncaught TypeError: Cannot call method 'create' of undefined

    localstorage: Uncaught TypeError: Cannot call method 'create' of undefined


    sencha touch 2 PR2
    google chrome

    source code:

    Code:
    Ext.setup({
        icon: 'icon.png',
        tabletStartupScreen: 'tablet_startup.png',
        phoneStartupScreen: 'phone_startup.png',
        glossOnIcon: false,
        onReady: function(){
    
    		Ext.define('Search', {
    		    extend: 'Ext.data.Model',
    		    fields: ['id', 'query']
    		});
    		
    		//our Store automatically picks up the LocalStorageProxy defined on the Search model
    		var store = Ext.create('Ext.data.Store', {
    		    model: "Search",
    		    proxy: {
    		        type: 'localstorage',
    		        id  : 'test-Searches'
    		    }
    		});
    		
    		//loads any existing Search data from localStorage
    		store.load();
    		
    	//	//now add some Searches
    		store.add({query: 'Sencha Touch'});
    		store.add({query: 'Ext JS'});
    	//	
    	//	//finally, save our Search data to localStorage
    		store.sync();
    	}
    });
    the source code form Sencha Touch Document.

    error: Uncaught TypeError: Cannot call method 'create' of undefined

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Location
    Clermont-Ferrand, France
    Posts
    4
    Vote Rating
    0
    Christophe.firpo is on a distinguished road

      0  

    Default


    Hi,

    I've the same problem, anyone could help us?

  3. #3
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    There are some issues with the data package in the current PR, including this bug. These issues will be fixed before the GA.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #4
    Sencha User aflx's Avatar
    Join Date
    Jun 2011
    Location
    Berlin, Germany
    Posts
    64
    Vote Rating
    0
    aflx is on a distinguished road

      0  

    Default


    I had the same error. This is because the proxy-property in the Ext.data.Batch is never set. As a workaround you can add this to the constructor:

    Code:
    if (config.hasOwnProperty) {
      this.proxy = config.proxy;
    }

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Location
    León, Spain
    Posts
    77
    Vote Rating
    3
    diesalher is on a distinguished road

      0  

    Default


    Quote Originally Posted by aflx View Post
    I had the same error. This is because the proxy-property in the Ext.data.Batch is never set. As a workaround you can add this to the constructor:

    Code:
    if (config.hasOwnProperty) {
      this.proxy = config.proxy;
    }
    Thanks! It worked

  6. #6
    Sencha User
    Join Date
    Mar 2008
    Posts
    2
    Vote Rating
    0
    coolstr is on a distinguished road

      0  

    Default


    Thank you very much! It worked too.

  7. #7
    Sencha User
    Join Date
    Nov 2011
    Location
    Clermont-Ferrand, France
    Posts
    4
    Vote Rating
    0
    Christophe.firpo is on a distinguished road

      0  

    Default


    Hi,

    I would be possible to have more code because I can't understand how to use this indication?

    Thank you.

  8. #8
    Sencha User aflx's Avatar
    Join Date
    Jun 2011
    Location
    Berlin, Germany
    Posts
    64
    Vote Rating
    0
    aflx is on a distinguished road

      0  

    Default


    You have to change the contructor of Ext.data.Batch in your sencha-js file. I did it for the sencha-touch-all-debug.js. You will find the definition of this class at line 21456. There you have to change the constructor like this:

    Code:
    constructor: function(config) {
        var me = this;
    
        // aflx
        if (config.hasOwnProperty) {
            this.proxy = config.proxy;
        }
    
        me.mixins.observable.constructor.call(me, config);
        me.operations = [];
    },
    Hopefully this will be fixed with the next update. Sencha announced several updates to the data package.

  9. #9
    Sencha User
    Join Date
    Nov 2011
    Location
    Clermont-Ferrand, France
    Posts
    4
    Vote Rating
    0
    Christophe.firpo is on a distinguished road

      0  

    Default


    That's work, thank you...

  10. #10
    Sencha User
    Join Date
    Sep 2010
    Location
    Austria
    Posts
    59
    Vote Rating
    2
    samlinux is on a distinguished road

      0  

    Default


    Is this still a problem in PR 3, also affects sessionstorage, that's right ?

    I think it's, but with the fix of aflx it work's