1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Germany, Lauenhagen
    Posts
    2
    Vote Rating
    0
    Mike Mandel is on a distinguished road

      0  

    Thumbs up 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:
    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');
            }
        });
    Thanks for your help!

    Mike

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

      0  

    Exclamation


    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:
    Code:
    destroy: function() {}   --> line 2394 in ext-core-debug.js
    In other words Model.destroy() functionality is not implemented yet in the current developer preview

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Location
    Germany, Lauenhagen
    Posts
    2
    Vote Rating
    0
    Mike Mandel is on a distinguished road

      0  

    Default


    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

  1. [OPEN-126] Model.destroy method doesn't exist
    By abierbaum in forum Sencha Touch 1.x: Discussion
    Replies: 7
    Last Post: 6 Feb 2012, 9:19 AM
  2. Model Association does not work in case of xml
    By babar.sajjad in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 28 Jan 2011, 5:52 AM
  3. listener beforeclose or before destroy don'work
    By genTaliaru in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 May 2009, 10:38 PM
  4. dialog.destroy doesn't always work
    By cwolves in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 10 Jul 2007, 8:05 PM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi