I am trying to get a “has Many” association working using a localstorage. I set up two models : User and Products. My user has many Products. I want to:
Load my user via AJAX from a server after the user is authorized. The Products are already stored in the localstorage (e.g. {“id”:”ext-record-1″,”user_id”:1,”name”:”product1″}).
// The id and name are loaded via ajax
var user = Ext.create('User', {id: 1, name: 'Ed'});
var userProducts = user.products();
userProducts.load();
The problem is: All the instances from the store / proxy are loaded if i call the association. According to the docs there should only be the instances with “user_id” : 1
The filter is set. It only happens if i load the products from the localstorage, if i create them in place there is no problem. The saving to a localstore breaks the association.
And i set up an example without a localstorage here:
http://www.senchafiddle.com/#J9VX6
And with the localstorage: http://www.senchafiddle.com/#J9VX6#hBDkq
See http://docs.sencha.com/touch/2-0/#!/api/Ext.data.association.HasMany
I really appreciate your help
It seems as this is a known bug, i got the link on my question in the sencha touch forum:
http://www.sencha.com/forum/showthread.php?173327-WebStorage-proxy-can-t-deal-with-associated-data
I think this will not be solved until the next version of Sencha Touch