-
16 Nov 2012 4:10 AM #1
ST 2.1 Store remove record fails with: Cannot call method 'hasOwnProperty' of null
ST 2.1 Store remove record fails with: Cannot call method 'hasOwnProperty' of null
Hi,
I'm trying to remove a record from a store of a hasMany association.
Code:activeCheckIn.orders().remove(order);
This operation fails with a Cannot call method 'hasOwnProperty' of null in model.js Line 798.Code:associations: [{ type: 'hasMany', model: 'MyApp.model.Order', name: 'orders', store: { syncRemovedRecords: false } }]
Debugging revealed that during removing of the record in model.js destroy function modified is set to null.
Later in hasMany.js onRemoveRecords the foreign key is set to nullCode:destroy: function() { var me = this; me.notifyStores('afterErase', me); if (me.getUseCache()) { delete Ext.data.Model.cache[Ext.data.Model.generateCacheId(me)]; } me.raw = me.stores = me.modified = null; me.callParent(arguments); },
This fails in the Model.js set method in Line 798 because obviously modified is null.Code:onRemoveRecords: function(store, records) { var ln = records.length, i, record; for (i = 0; i < ln; i++) { record = records[i]; record.set(this.getForeignKey(), null); } },
Code:if (modified.hasOwnProperty(fieldName)) {
A Workaround for this problem is to set destroyRemovedRecords: false
-
16 Nov 2012 10:19 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
Thanks for the report! I have opened a bug in our bug tracker.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3720
in
Sprint 29.


Reply With Quote