1. #1
    Sencha User fabio.policeno's Avatar
    Join Date
    Sep 2010
    Location
    Curitiba - PR / Brasil
    Posts
    301
    Answers
    15
    Vote Rating
    4
    fabio.policeno is on a distinguished road

      0  

    Default Unanswered: update and destroy records don't work

    Unanswered: update and destroy records don't work


    Hello,

    I'm trying to update and delete operations of a record but I localStorage proxy returns the following error (see comments in the code):
    Uncaught TypeError: Cannot call method 'update' of undefined
    Uncaught TypeError: Cannot call method 'destroy' of undefined
    The following code:
    Code:
    save: function() {
            var me = this,
                form = me.getForm().down('formpanel'),
                values = form.getValues(),
                store = me.getList().getStore(),
                record;
    
            if(values.id){
                record = form.getRecord();
                console.log(values) // return object Cliente
                console.log(record) // retunr model Cliente populated
                //Uncaught TypeError: Cannot call method 'update' of undefined
                record.set(values);
            }
            else{
                record = Ext.ModelManager.create(form.getValues(), 'ExtTouch.model.Cliente');
            }
            
            record.save();
            store.load();
        
            me.getList().deselectAll();
            me.getList().up('panel').setActiveItem(me.getList());
        },
        
        destroy: function() {
            var me = this,
                form = me.getForm().down('formpanel'),
                record = form.getRecord(),
                store = me.getList().getStore();
            console.log(record) // return model Cliente populated
            console.log(store) // return store Cliente
            //Uncaught TypeError: Cannot call method 'destroy' of undefined
            store.remove(record);
            
            me.getList().deselectAll();
            me.getList().up('panel').setActiveItem(me.getList());
        }
    Thank's

  2. #2
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    ajchia is on a distinguished road

      0  

    Default


    I've noticed the same issue. For updates, I got around it by calling record.save() then store.sync() store.load() (but not when a list is on screen else you get something like cannot set innerHTML).

    If you figure out a way to do a record.destroy() and clean up the store I'd like to know. I've tried .destroy() but the store looks really bad afterwards even with a sync() load() (record half removed) and will freeze your list loading on page refresh.

  3. #3
    Sencha User fabio.policeno's Avatar
    Join Date
    Sep 2010
    Location
    Curitiba - PR / Brasil
    Posts
    301
    Answers
    15
    Vote Rating
    4
    fabio.policeno is on a distinguished road

      0  

    Default


    Yeah, I surprised. To create new records is working perfectly.

    Waiting for solution ...

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar