1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    tachtevrenidis is on a distinguished road

      0  

    Default Unanswered: Can't get store CRUD methods to be called

    Unanswered: Can't get store CRUD methods to be called


    I have a button (on a form.Panel) with the follow tap handler:

    Code:
                                var thisController = this;
                                var store = thisController.getContactsStore();
                                var cmVp = thisController.getCmViewport();
                                var bar = cmVp.getNavigationBar();
    
    
                                bar
                                        .add({
                                            id : 'donebutton',
                                            xtype : 'button',
                                            align : 'right',
                                            text : addOrEdit,
                                            ui : 'action',
                                            listeners : {
                                                'tap' : function(component, e,
                                                        eOpts) {
                                                    console
                                                            .log('CM.controller.Contacts doneButton onTap');
    
    
                                                    var updatePanel = thisController
                                                            .getContactUpdatePanel();
    
    
                                                    var panelRecord = updatePanel
                                                            .getRecord();
                                                    if (panelRecord != null) {
                                                        console
                                                                .log('updating contact');
    
    
                                                        updatePanel.updateRecord(
                                                                panelRecord, true);
    
    
                                                        console
                                                                .log('record updated');
    
    
                                                        if (panelRecord.dirty) {
                                                            console
                                                                    .log('record is dirty');
    
    
                                                            panelRecord.save();
    
    
                                                            console
                                                                    .log('record saved');
    
    
                                                            store.sync();
    
    
                                                            console
                                                                    .log('store synced');
                                                        } else {
                                                            console
                                                                    .log('record is not dirty, bailing');
                                                        }
                                                    }
    The store->proxy handler currently only contain a console.log() statement (they are empty) except for read() which works. The moment the code above hits: 'panelRecord.save()' it kinda hangs (I don't see the console.log immediately afterwards). I have tried many things with no success. What am I doing wrong?
    The console.log statements I see in the log are:

    2012-01-10 10:42:14.451 SenchaTouch2POC[7585:fb03] [INFO] doneButton onTap
    2012-01-10 10:42:14.452 SenchaTouch2POC[7585:fb03] [INFO] updating contact
    2012-01-10 10:42:14.453 SenchaTouch2POC[7585:fb03] [INFO] record updated
    2012-01-10 10:42:14.453 SenchaTouch2POC[7585:fb03] [INFO] record is dirty

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Answers
    3354
    Vote Rating
    747
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You shouldn't call save() on the model. sync() on the store will handle the saving.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    tachtevrenidis is on a distinguished road

      0  

    Default


    thanks for the quick response. If I remove panelRecord.save(), there is no change in behavior. I never see:

    Code:
    console.log('store synced');
    and I never see the console.log() from the store->proxy->update() method. I know I have the right reference to the store because if (right before store.sync()) i do a:

    Code:
    console.log(store.getTotalCount());
    I see '2' in the console log which is correct, my store has 2 records. I must be missing something OBVIOUS!

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    tachtevrenidis is on a distinguished road

      0  

    Default


    there must be something I am doing wrong? Anybody out there who can help me? Do I need to post more code to provide a more complete picture?

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