Search code examples
javascriptextjsmodelstoresencha-architect

Ext.Js model store objects


How can I adopt my ext js models to hold data containing objects.

Data example:

fruit {
    apples {
        quantity: '10',
        color: 'red
    }
    pears {
        color:'yellow',
        taste: 'very bad'
    }

How would then my model look like? I only know how to put data on one level:

Ext.define('app.mode.Fruits', {
    extend: 'Ext.data.Model',

    fields: [
        {
            name: 'apples'
        },
        {
            name: 'pears'
        },
    ],

Where can I put the other properties? I am working in Sencha Architect.


Solution

  • Take a read through the Ext.data.Field API docs. You'll see a variety of ways in which to configure data on your model.

    I think what you're specifically asking for is the mapping config.