-
3 Nov 2011 10:46 AM #1
Store throwing an error when syncing with REST proxy
Store throwing an error when syncing with REST proxy
Controller:
Model:Code:onPanelHide: function(pnl, eobj) { console.log('on hide'); var profile = Ext.data.StoreManager.lookup('Profile'); if (profile.getUpdatedRecords().length > 0) { profile.sync(); } }
Store: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' } });
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
-
3 Nov 2011 11:30 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
Thank you for the report.
-
3 Nov 2011 11:51 AM #3
Workaround
Workaround
As a work around:
seems to accomplish what I was looking for.Code:if (profile.getUpdatedRecords().length > 0) { Ext.each(profile.getUpdatedRecords(), function(it, index, profile) { it.save(); }); }
-
6 Jan 2012 9:56 AM #4Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 5
This has been fixed and will be part of the next Touch 2.0 release. Thanks again for the report!
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-972
in
2.0.


Reply With Quote
