代理的基类是Ext.data.proxy.Proxy。模型和存储使用代理来处理模型数据的加载和保存。
有两种类型的代理:
- 客户代理
- 服务器代理
客户代理
客户端代理包括使用HTML5本地存储的内存和本地存储。
服务器代理
服务器代理使用Ajax,Json数据和Rest服务处理来自远程服务器的数据。代理可以用模型编写并存储在任何地方。
Ext.create('Ext.data.Store', {
model: 'StudentDataModel', proxy : {
type : 'rest', actionMethods : {
read : 'POST'
// Get or Post type based on requirement
},
url : 'restUrlPathOrJsonFilePath',
// here we have to include the rest URL path
which fetches data from database or Json file path where the data is stored reader: {
type : 'json',
// the type of data which is fetched is of JSON type
root : 'data'
},
}
});作者:terry,如若转载,请注明出处:https://www.web176.com/senchatouch/1631.html
支付宝
微信