PDA

View Full Version : POST or PUT JSON with store.save()



meediake
29 Apr 2011, 4:46 AM
Hello!

Is it possible to somehow normally configure the store to send JSON with PUT and POST?

Currently it sends urlencoded JSON(data=someencodedjsonhere). This is not beautiful, restful and doesnt make any sense.

Any help would be appreciated!

Sigmar

friend
29 Apr 2011, 6:40 AM
Visit the API docs for Ext.data.JsonStore (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.data.JsonStore) and look at the restful attribute.

meediake
29 Apr 2011, 8:54 AM
I have already this property set to true. But this Store is still not fully restful, it sends data back wrapped to some variable and urlencoded :((

meediake
29 Apr 2011, 9:21 AM
To get this working, I added "encode: false" parameter to my json writer. Also I followed guidelines from here:
http://stackoverflow.com/questions/2925751/how-do-i-get-an-extjs-jsonstore-to-put-the-json-data-directly-into-the-request-bo

Nasty hack but I cannot figure out any better solution also.

My REST service is not able to handle these uncommon wrapper variables that ext offers..

Configuring Ext to work with Jersey and other standard REST libs is a challenge...

friend
29 Apr 2011, 9:24 AM
Take a look at the Ext.data.JsonWriter (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.data.JsonWriter) API docs and visit the encode config attribute.

mitchellsimoens
29 Apr 2011, 12:38 PM
To change the method of transmission you can configure such on the Proxy. Look at the example under the 'api' config option.