Sencha Touch - Proxy



The base class for proxy is Ext.data.proxy.Proxy. Proxy is used by Models and Stores to handle the loading and saving of Model data.

There are two types of proxies −

  • Client Proxy
  • Server Proxy

Client Proxy

Client proxies include Memory and Local Storage using HTML5 local storage.

Server Proxy

Server proxies handle data from the remote server using Ajax, Json data, and Rest service. Proxies can be written in model and store anywhere.

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'
      },
   }
});
sencha_touch_data.htm
Advertisements