I have two stores. Store A is backed by localStorage, and has no associations.
Store B is built in memory, and associates hasMany to Store A. It's an aggregation store.
Ext.define('B', {
extend: 'Ext.data.Model',
config: {
identifier: 'uuid',
fields: [
{name: 'id', type: 'string'},
{name: 'value', type: 'int'}
],
hasMany: {model: 'A', name: 'others'},
proxy: {
type: 'memory',
id: 'some-id'
}
}
});
Given a store that backs B, I can't remove A records. I've tried a number of things, and everything is broken.
First try:
Code:
bStore.first().others().removeAll();
bStore.sync();
Examining localStorage, the A records are still alive in localStorage, and are even still in aStore.
Second try:
Code:
var others = bStore.first().others();
others.removeAll();
bStore.sync();
others.each(function(o){aStore.remove(o);});
aStore.sync();
The individual proxy-uuid records are removed for aStore, but the aStore localStorage element still references the individual records.
In localStorage:
aProxy: uuid1,uuid2,uuid3
But none of the associated aProxy-uuid records exist.
Attempt 3:
Code:
var others = bStore.first().others();
others.each(function(o){aStore.remove(o);});
aStore.sync();
This yields the same behavior as #2. What could possibly be going wrong here?