-
16 Feb 2011 9:15 AM #1
[CLOSED]Model.save also fails...
[CLOSED]Model.save also fails...
This also fails with the following error:Code:var user = Ext.ModelMgr.create({name: 'Ed Spencer', email: 'ed@sencha.com'}, 'User'); user.save(); //POST /users
me.getProxy() is undefined
ext-all-debug.js (line 25850):
Code:me.getProxy()[action](operation, callback, me);
-
17 Feb 2011 4:26 AM #2Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
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
-
17 Feb 2011 9:47 AM #3
What am I doing wrong?
What am I doing wrong?
Ed, thank you for your reply!
Perhaps I should have pasted my entire code:
As you see there is a rest proxy defined in the model...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'); } }); });
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!
-
17 Feb 2011 7:44 PM #4
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!
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Uncaught ReferenceError: id is not defined When .save() with REST Model
By Jeff Blake in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 18 Jan 2011, 3:54 PM -
Add record to store fails to save remotely
By [Daniel] in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 17 Nov 2010, 2:34 AM -
Save the column model changes
By Shaguar in forum Ext 2.x: Help & DiscussionReplies: 13Last Post: 17 Nov 2008, 12:13 PM


Reply With Quote