I admittedly am pretty new to using the Sencha designer but I decided to give the beta of version 2 a try and I am having trouble figuring something out. I am using a custom proxy that is based heavily on a json proxy I found on these very forums:
Code:
Ext.define('Ext.data.JsonProxy', {
extend: 'Ext.data.AjaxProxy',
alias: 'proxy.json',
store: 'Afes',
doRequest: function(operation, callback, scope) {
var writer = this.getWriter(),
request = this.buildRequest(operation, callback, scope);
if (operation.allowWrite()) {
request = writer.write(request);
}
Ext.apply(request, {
headers : this.headers,
timeout : this.timeout,
jsonData : request.params,
scope : this,
callback : this.createRequestCallback(request, operation, callback, scope),
method : this.getMethod(request),
disableCaching: false // explicitly set it to false, ServerProxy handles caching
});
delete request.params;
Ext.Ajax.request(request);
return request;
},
constructor: function() {
Ext.data.JsonProxy.superclass.constructor.apply(this, arguments);
this.actionMethods.read = 'POST';
}
});
That I have just thrown at the top of my app.js (I know, this is a bad idea, I am trying to figure out the correct way to use it). I can then use this proxy as follows:
Code:
Ext.define('AN.store.Afes', {
extend: 'Ext.data.Store',
model: 'AN.model.Afe',
storeId: 'afeStore',
autoLoad: false,
proxy: {
type: 'json',
reader: {
type: 'json',
root: 'd.AllRows',
successProperty: 'success',
totalProperty: 'total'
},
api: {
create: 'jsonsvc/TestCall',
read: '/jsonsvc/TestCall',
update: 'jsonsvc/TestCall',
destroy: 'jsonsvc/TestCall'
},
}
});
Things work like this, however when I try to implement these models and stores and controllers in the designer I am only able to use a normal ajax proxy, and I seem to be unable to create my own proxy type. I use this proxy on a large number of different stores if that matters.
Can somebody please tell me, what is the right way to use this proxy? Is it even possible to do within the designer?