extjs的Ext.data.proxy.Proxy的Reader(Ext.data.reader.Reader)浅析

译自:http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.proxy.Proxy-cfg-reader

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.reader.Reader

The Ext.data.reader.Reader to use to decode the server's response or data read from client. This can either be a Reader instance, a config object or just a valid Reader type name (e.g. 'json', 'xml').

Available since: 4.0.4


Reader 用来对服务器的响应数据 和 客户端读取的数据进行加密。

Readers are used to interpret data to be loaded into a Model instance or a Store - often in response to an AJAX request. In general there is usually no need to create a Reader instance directly, since a Reader is almost always used together with a Proxy, and is configured using the Proxy's readerconfiguration property:

Ext.create('Ext.data.Store', {
    model: 'User',
    proxy: {
        type: 'ajax',
        url : 'users.json',
        reader: {
            type: 'json',
            root: 'users'
        }
    },
});

The above reader is configured to consume a JSON string that looks something like this:

{
    "success": true,
    "users": [
        { "name": "User 1" },
        { "name": "User 2" }
    ]
}
Reader 用来解析被加载到Model实例或者Store中的数据 -通常用来相应一个 AJAX 请求。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值