重庆熊猫 Loading

ExtJS 数据处理-Schema(架构)

更新记录
2022年7月22日 发布。
2022年7月16日 从笔记迁移到博客。

ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html

Ext.data.Schema(架构)

架构是相互关联的实体的集合
当Model中指定“schema”配置时,该schma将被所有派生模型继承

常见配置项:

namespace		通过指定此命名空间,所有模型都将获得一个缩写名
entityName		这个短名称在定义模型之间的关联时非常有用
proxy			这是一个对象模板,类似于基于Ext.XTemplate的文本模板
Ext.define('MyApp.model.Base', {
    extend: 'Ext.data.Model',

    fields: [{
        name: 'id',
        type: 'int'
    }],
    //防撬 panda 666 p防anda 666
    schema: {
        namespace: 'MyApp.model',  // generate auto entityName

        proxy: {     // Ext.util.ObjectTemplate
            type: 'ajax',
            url: '{entityName}.json',
            reader: {
                type: 'json',
                rootProperty: '{entityName:lowercase}'
            }
        }
    }
});
posted @ 2022-07-22 07:10  重庆熊猫  阅读(112)  评论(0编辑  收藏  举报