-
25 Feb 2011 4:16 AM #1
Model.destroy() does not work
Model.destroy() does not work
Hello,
I have problems to delete a user with the new Ext.Data.Model package.
To test it, I simply chained the CRUD operations together.
So first create the new user, then update and finally delete.
Creating and updating works fine, but I can´t delete the user.
In the server logs, I can see the url calls when creating and updating the user.
But there is no url call for delete.
Deleting the user with curl works fine.
The backend is written with the Perl Catalyst Framework using REST style.
Maybe it´s a bug in Ext JS?
Here is my code:
Thanks for your help!Code:Ext.regModel('User', { fields: [ 'id', 'name', 'email' ], proxy: { type: 'rest', url: '/user', reader: { type: 'json', root: 'user', successProperty: 'success' } } }); //create the user var user = Ext.ModelMgr.create({name: 'Mike', email: 'my@email'}, 'User'); user.save({ success: function(user) { console.log('ID ' + user.getId()); //update the user user.set({name: 'Mike Mandel'}); user.save({ success: function(user) { console.log('user updated ' + user.get('name')); //delete the user user.destroy({ success: function(user) { console.log('user deleted'); }, failure: function(user) { console.log('user delete failed'); } }); }, failure: function(user) { console.log('user update failed'); } }); }, failure: function(user) { console.log('user create failed'); } });
Mike
-
28 Feb 2011 7:53 AM #2
It happens because there's no destroy() method defined on Model yet (dev preview 2).
I believe calling destroy() on any model just falls back to this empty function call:
In other words Model.destroy() functionality is not implemented yet in the current developer previewCode:destroy: function() {} --> line 2394 in ext-core-debug.js
-
28 Feb 2011 3:21 PM #3
Thanks for your response!
You are right. It seems, that this function is not yet implemented.
I wrote a simple console.log('destroy()') inside the destroy() function to get some debugging output.
Let´s hope, that it gets fixed in one of the next releases.
Mike
Similar Threads
-
[OPEN-126] Model.destroy method doesn't exist
By abierbaum in forum Sencha Touch 1.x: DiscussionReplies: 7Last Post: 6 Feb 2012, 9:19 AM -
Model Association does not work in case of xml
By babar.sajjad in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 28 Jan 2011, 5:52 AM -
listener beforeclose or before destroy don'work
By genTaliaru in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 17 May 2009, 10:38 PM -
dialog.destroy doesn't always work
By cwolves in forum Ext 1.x: BugsReplies: 1Last Post: 10 Jul 2007, 8:05 PM


Reply With Quote