Categories: Sencha Touch 教程

Sencha Touch:数据包 – 代理

代理的基类是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

这个人很懒,什么都没有留下~

Share
Published by
terry

Recent Posts

自定义指令:聊聊vue中的自定义指令应用法则

今天我们来聊聊vue中的自定义…

3 天 ago

聊聊Vue中@click.stop和@click.prevent

一起来学下聊聊Vue中@cli…

1 周 ago

Nginx 基本操作:启动、停止、重启命令。

我们来学习Nginx基础操作:…

2 周 ago

Vue3:手动清理keep-alive组件缓存的方法

Vue3中手动清理keep-a…

2 周 ago

聊聊React和Vue组件更新的实现及区别

React 和 Vue 都是当…

3 周 ago