Sencha-touch-data-proxy

提供:Dev Guides
移動先:案内検索

Sencha Touch-プロキシ

プロキシの基本クラスはExt.data.proxy.Proxyです。 モデルデータの読み込みと保存を処理するために、モデルとストアがプロキシを使用します。

プロキシの2種類があります-

  • クライアントプロキシ
  • サーバープロキシ

クライアントプロキシ

クライアントプロキシには、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'
      },
   }
});