PDA

View Full Version : DataWriter Example does not work with DirectProxy



jcalfee
5 Apr 2010, 1:12 PM
In the Grid Writer example, if you replace the HttpProxy with a DirectProxy only the read API call works:

http://www.extjs.com/deploy/dev/examples/writer/writer.html

The read works fine and the grid populates :D

Request:
{"action":"WriterDirect","method":"readUserInfo","data":null,"type":"rpc","tid":2}
Response:
{"tid":2,"action":"WriterDirect","method":"readUserInfo","result":{"total":
0,"success":true,"message":"Here is your example data...","data":[{"id":
1,"email":"user@example.com","first":"UserFirst","last":"UserLast"}]},
"type":"rpc"}


the delete does not send an ID so that fails on the server

Req:
{"action":"WriterDirect","method":"destroyUser","data":[],"type":"rpc","tid":3}
Resp:

{"tid":3,"action":"WriterDirect","method":"destroyUser","message":
"ArrayIndexOutOfBoundsException: 0","where":
"java.lang.ArrayIndexOutOfBoundsException:...",
"type":"exception"}


the create blows up in the Ext.direct.RemotingProvider doForm method ext-all-debug.js:39939 ... The error is "form is undefined"
the update blows in the same place saying "form is undefined"


ext-all-debug.js:39939 (version 3.2.0)

var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data', I'm pulling the same ext libraries as the example.

jcalfee
6 Apr 2010, 5:34 AM
In the Grid Writer example, if you replace the HttpProxy with a DirectProxy only the read API call works

Hold up... I think I had an error in my API. I'm still working this out. Thanks...jc

kodomo
8 Apr 2010, 7:35 AM
When you change from a HttpProxy to a DirectProxy you need to set "encode: false" in the JsonWriter. If you don't, the transactions go with no data.

dgaspar
11 Oct 2010, 8:37 PM
Hi, I'm having the same problem with create in DataWriter example, when I try to use DirectProxy!

(obs: I've set encode to false, so delete works... but not create)



doForm : function(c, m, form, callback, scope){

...

if(this.fireEvent('beforecall', this, t, m) !== false){
Ext.Direct.addTransaction(t);
// bug!!
var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data',


When using DirectProxy, doForm() is called with a form argument which is not a real form,
it's just a simple Object (containing the params)...

Help!! is this a bug?

dgaspar
12 Oct 2010, 12:40 PM
Oops, nevermind, I was using formHandler:true in the API

:/