Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-972 in a recent build.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    55
    Vote Rating
    0
    justinKohactive is on a distinguished road

      0  

    Default Store throwing an error when syncing with REST proxy

    Store throwing an error when syncing with REST proxy


    Controller:
    Code:
    onPanelHide: function(pnl, eobj) {
            console.log('on hide');
            var profile = Ext.data.StoreManager.lookup('Profile');
            
            
            
            if (profile.getUpdatedRecords().length > 0) {
                profile.sync();
            }
        }
    Model:
    Code:
    Ext.define('LegalProxy.model.Profile', {
        extend: 'Ext.data.Model',
        hasMany: ['Locations', 'Expertises'],
        idProperty: '_id',
        fields: [
                {name: '_id', type: 'string'},
                {name: 'firstName',  type: 'string'},
                {name: 'lastName',  type: 'string'},
                {name: 'company',  type: 'string'},
                {name: 'address',  type: 'string'},
                {name: 'address2',  type: 'string'},
                {name: 'city',  type: 'string'},
                {name: 'state',  type: 'string'},
                {name: 'zipcode',  type: 'int'}
        ],
        proxy: {
               type: 'rest',
               url: endpoint + '/profiles'
        }
    
    });
    Store:
    Code:
    Ext.define('LegalProxy.store.Profile', {
               extend  : 'Ext.data.Store',
               model   : 'LegalProxy.model.Profile',
               storeId : 'profileStore',
               requires: ['LegalProxy.model.Profile']
    });

    Data loads fine into the store, and its marked dirty and as a updatedRecord, but when I call sync i get:

    all-debug.js:21515 Uncaught TypeError: Cannot call method 'update' of undefined

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    19
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the report.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    55
    Vote Rating
    0
    justinKohactive is on a distinguished road

      0  

    Default Workaround

    Workaround


    As a work around:

    Code:
    if (profile.getUpdatedRecords().length > 0) {
                Ext.each(profile.getUpdatedRecords(), function(it, index, profile) {
                    it.save();
                });
            }
    seems to accomplish what I was looking for.

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    This has been fixed and will be part of the next Touch 2.0 release. Thanks again for the report!

Thread Participants: 2