PDA

View Full Version : [FIXED][3.0 RC1] Ext.data.DirectProxy directFn



bas_denis
16 Apr 2009, 6:16 PM
as of data/DirectStore.js
line 46

proxy: (typeof(c.proxy) == 'undefined') ? new Ext.data.DirectProxy(Ext.copyTo({}, c, 'paramOrder,paramsAsHash,directFn,api')) : c.proxy,
the default proxy should get a directFn property via the stores initial config

DirectProxy doesn't care about any directFn property

doRequest : function(action, rs, params, reader, writer, cb, scope, options) {
var args = [];
var directFn = this.api[action];
switch (action) {
case 'save':
args.push(params[reader.meta.idProperty]); // <-- save(Integer/Integer[], Hash/Hash[])
args.push(params[writer.dataProperty]);
break;
case 'destroy':
args.push(params[writer.dataProperty]); // <-- destroy(Int/Int[])
break;
case 'create':
args.push(params[writer.dataProperty]); // <-- create(Hash)
break;
case 'load':
args.push(params); // <-- load(Hash)
break;
}
args.push(this.createCallback(action, reader, cb, scope, options));
directFn.apply(window, args);
},

kind regards

relation added: Child of [3.0 RC1] Ext.data.DirectProxy incomplete ? (http://extjs.com/forum/showthread.php?t=65919)

christocracy
21 Apr 2009, 10:38 PM
added back the directFn configuration-param on DirectProxy.

DirectProxy (all proxies actually) can be configured with a full CRUD api or just a single directFn for when only executing the load action.


var dproxy = new Ext.data.DirectProxy({
directFn: Users.load
})


Or the full api config:


var dproxy = new Ext.data.DirectProxy({({
api: {
load: Users.load,
create: Users.create,
save: Users.update,
destroy: Users.destroy
});


If you define both an api and a directFn, the api-config will supercede the directFn.