简体   繁体   English

Ext.Js模型存储对象

[英]Ext.Js model store objects

How can I adopt my ext js models to hold data containing objects. 如何采用ext js模型来保存包含对象的数据。

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. 我在Sencha Architect工作。

Take a read through the Ext.data.Field API docs. 通读Ext.data.Field API文档。 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. 我认为您特别需要的是映射配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM