PDA

View Full Version : Ext.data.proxy - Issue



mityung
27 Feb 2014, 3:52 AM
I am facing a issue when using Sencha Architect 3.0, I need to consume get/post web service deployed on different server.

Different approaches i tried :


1) Now, i know that i need to use JsonP for this functionality but the response i recieve is with content type - text/plain and thus can't be rendered by browser (it throws an exception).
I used Ext.data.proxy.JsonP in this.


Please suggest on how to parse response to json object before it gets loaded to store or reader.

2) Second Approach i tried was using Ext.data.proxy.Ajax and having server in my control, i allowed CORS on server.
The only issue i am facing is that Ajax.request method="OPTIONS" is being sent by browser along with Normal Request.
For which i found this solution : Ext.lib.Ajax.useDefaultHeader = false;
but i am unable to use this in Sencha Architect. I am unaware on how to override classes as well.

Please suggest on how to do this, and also explain how will it affect the system if i will let browser hit method="OPTIONS" to server.

3) Lastly, i am trying to avoid any manual code for (ext.ajax) ws consume/send. i am syncing all data via store.
Is this a correct approach ? My application has different forms which need to be added/updated constantly. Should i use conventional way of ext code on handler of add/update buttons or sync it with store ?


Any suggestion will be of great help.
Thanks in advance.

PS : I am using Sencha Architect 3.0, which has limited options to configure than Ext JS Framework.
Many options / Writing manual code is not allowed. (Or may be i dont know that much)

mitchellsimoens
3 Mar 2014, 8:39 AM
1. JsonP is just Javascript so it needs to be able to be executed by the browser just like <script> nodes must be.
2. This is an issue for Architect then. The OPTIONS request is the browser checking to see if the server will allow CORS requests. I personally would leave that request and handle it on the server.
3. Just depends on what is needing, a full data store may be overkill.

mityung
10 Mar 2014, 9:28 PM
Its regarding 3rd Point mentioned - Full data store may overkill
Can you explain in what situation it might overkill ??

Let me rephrase my question again :-

My application has multiple grids & forms with add & update button on top.
I have connected forms and grids with their respective stores.


These Grids/Forms need to be updated quite frequently,both to and from server
Now while reading about stores from tutorials, i found that store.sync() is correct method to be used.


But i need to send some other dynamic values as well along with usual Post data to server.
Also i need to capture response from server and do some action. I am unable to find any thing like that in architecture.


Should i use Ext.ajax method on click of button, though this was the method i was trying to avoid.