Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2009
    Location
    Bucharest, Romania
    Posts
    70
    Vote Rating
    0
    icflorescu is on a distinguished road

      0  

    Default [CLOSED]Model.save also fails...

    [CLOSED]Model.save also fails...


    Code:
    
    var user = Ext.ModelMgr.create({name: 'Ed Spencer', email: 'ed@sencha.com'}, 'User');
    user.save(); //POST /users
    
    This also fails with the following error:
    me.getProxy() is undefined

    ext-all-debug.js (line 25850):
    Code:
    me.getProxy()[action](operation, callback, me);

  2. #2
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    We need to have a better error message here. The Model has no way of knowing how to save itself without a Proxy defined (the Proxy handles all of the loading and saving). This might be helpful to you: http://www.sencha.com/blog/using-the...-sencha-touch/
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  3. #3
    Sencha User
    Join Date
    Oct 2009
    Location
    Bucharest, Romania
    Posts
    70
    Vote Rating
    0
    icflorescu is on a distinguished road

      0  

    Default What am I doing wrong?

    What am I doing wrong?


    Ed, thank you for your reply!

    Perhaps I should have pasted my entire code:
    Code:
    Ext.onReady(function() {
    
    	Ext.regModel('User', {
    		fields: [ 'id', 'name', 'email' ],
    		proxy: {
    			type:	'rest',
    			url:	'data/users',
    			format:	'json'
    		}
    	});
    
    	var user = Ext.ModelMgr.create({name: 'User Name', email: 'email@gmail.com'}, 'User');
    	user.save({
    		success: function() {
    			console.log('The user was saved');
    		}
    	});
    	
    });
    As you see there is a rest proxy defined in the model...
    I don't understand, considering the code above, shouldn't user.save make a POST to data/users.json? Am I forgetting something?

    P.S. I think the data package looks fantastic!

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,665
    Vote Rating
    586
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Looks to be the same issue as here:

    http://www.sencha.com/forum/showthre...els-and-Stores

    Will close this one off.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. Uncaught ReferenceError: id is not defined When .save() with REST Model
    By Jeff Blake in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 18 Jan 2011, 3:54 PM
  2. Add record to store fails to save remotely
    By [Daniel] in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 17 Nov 2010, 2:34 AM
  3. Save the column model changes
    By Shaguar in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 17 Nov 2008, 12:13 PM

Thread Participants: 2