extjs5 - Extjs 5 data model - has many association -


I am trying to understand the new association concept in EXTGE 5 data models.

I found the following model

  // user Ext.define ('App.model.User', {extend: 'App.model.Base', field: [ {Name: 'id', type: 'string'}, {name: 'name', type: 'string'},], manyToMany: {Categories: {type: 'categories', role: 'categories', field: 'Categories', true: true}}}); // Category Ext.define ('App.model.Category', {extension: 'App.model.Base', constructor: function () {...}, field: [{name: 'id', type: ' String '}, {name:' categoryName ', type:' string '},]}); I have found the following json for the user:  
  {"user": {"id": "1", "name": "Foo "," Categories ": [1, 2, 3]}}  

When the user model is loaded, then the data store with the categories store Should start.

(My category model knows to change the number in the id and amp; categoryName objects)

For some reason when I use the user Trying to do, categories which are empty in store.

  userRecord.categories (); // There is no record  

How do I work out this?

please try it

// user

  Ext.define ('user', 'expansion:' app.data.model ', field: [{name:' id ', type:' string '}, {name:' name ', type:' String '},], there are several: {Categories: {type:' categories', role: 'categories', field:' categories', true: true}}});  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -