PDA

View Full Version : Ext.data.DirectProxy - where is the connection object?



ThorstenSuckow
10 Jul 2009, 5:22 AM
Can someone please tell me where a connection object gets instantiated when I configure Ext.data.Store to use with Ext.data.DirectProxy?

Here's my store config:



var store = new Ext.data.Store({
proxy : new Ext.data.DirectProxy({
api : {
read : '/someurl',
create: '/someurl',
delete : '/someurl',
update : '/someurl'
}
})
})



When I call "store.load()", it tries to to call "this.proxy.request(...)" but triggers an error, due to



var directFn = this.api[action] || this.directFn;
...
directFn.apply(window, args);


in DirectProxy.js' doRequest method - directFn holds an object with the api urls but thats about it, there is no connection object.


What am I missing/doing wrong here?

dj
11 Jul 2009, 8:11 PM
The js-doc for Ext.data.DirectProxy#api seams to be missing. DirectProxys use functions created by an Ext.direct.RemotingProvider - not urls.

So either use an Ext.data.HttpProxy:

var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
api : {
read : '/someurl',
create: '/someurl',
delete : '/someurl',
update : '/someurl'
}
})
})
or use Direct functions for the CRUD operations:


Ext.Direct.addProvider({
type:'remoting',
url:'/router',
namespace:'App.direct',
actions:[{...}]
});

...

var store = new Ext.data.Store({
proxy : new Ext.data.DirectProxy({
api : {
read : App.direct.some.function,
create: App.direct.some.function,
delete : App.direct.some.function,
update : App.direct.some.function
}
})
})