Interacting with legacy Has One associations in Extjs 5.1.1 -


i had upgrade 4.1.2 5.1.1 sole sake of widget columns. i'm having trouble getting hasone associations work.

i've got model looks this:

ext.define('pp.model.lm.foomodel', {     extend: 'ext.data.model',      requires: [         'ext.data.field.field'     ],      fields: [         {             name: 'id'         },         //boatload of simple fields     ],      hasone: {         model: 'pp.model.lm.foo1model',         name: 'foo1',         associationkey: 'foo1'     } }); 

when interact model, there no getter \ setter methods, , foo1model's data present object can accessed

record.get('foo1'); 

could please point out doing wrong?

i tried doing new approach - creating field reference desired model. works fine when call setfoo1, , get. but.

when make ajax request, , try reading received json using ext.data.reader.json, seems fail understand property in object in fact associated model. data in foo1 appears in model object in foo1 property. reqest returns array of models have many foomodels.

the json looks this:

{     "root": [{         "id": 4241,         "foos": [{             id: 2237,             "foo1": {                 "id": 1216             }         }]     }],     "success": true } 

it seems hasone doesn't exist in extjs 5.1 done this:

fields: [{      name: 'addressid',      reference: 'address',      unique: true  }] 

check model api more info.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -