Sencha Touch 2 MVC - How to implement and use a custom proxy

I have exactly the same problem from this question . However, I am using Sencha Touch 2, and I do not know how to actually use this store. I define my REST proxies inside model classes. How can I access this user proxy or use it?

proxy: { type: 'rest', url: 'http://someUrl', reader: { type: 'json', } } 
+4
source share
1 answer

It's pretty simple in Sencha Touch 2. It assumes you have MVC architecture.

First, you model - application / model / Image.js :

 Ext.define('MyApp.model.Image', { extend: 'Ext.data.Model', // Require your custom proxy requires: ['MyApp.proxy.MyCustomProxy'], config: { fields: ['name'], proxy: { // set the type of your proxy type: 'mycustomproxy' } } }); 

And then define your proxy - application / proxy / MyCustomProxy.js :

 Ext.define('MyApp.proxy.MyCustomProxy', { extend: 'Ext.data.proxy.Proxy', // Set your proxy alias alias: 'proxy.mycustomproxy', ... }); 
+10
source

Source: https://habr.com/ru/post/1393342/


All Articles