I am trying to understand the concept of a new association in Extjs 5 data models.
I have the following models
// User Ext.define('App.model.User', { extend: 'App.model.Base', fields: [ {name: 'id', type: 'string'}, {name: 'name', type: 'string'}, ], manyToMany: { Categories: { type: 'Categories', role: 'categories', field: 'categories', right: true } } }); // Category Ext.define('App.model.Category', { extend: 'App.model.Base', constructor: function () {...}, fields: [ {name: 'id', type: 'string'}, {name: 'categoryName', type: 'string'}, ] });
I have the following json for the user:
{ "user": { "id": "1", "name": "Foo", "categories": [1, 2, 3] } }
When the User model loads, it must initialize the category store with data.
(My Category model knows how to convert a number to an id object and categoryName)
For some reason, when I try to get user categories, the store is empty.
userRecord.categories(); // has no records
How can I make this work?