PDA

View Full Version : add Data Callback



BJochen
18 Apr 2011, 3:18 AM
Hi guys
Perhaps anyone has a nice idea for my problem :-)

I want to add data to a JSON - Store which save with a webservice to a database.
The webservice sends back a status message on success/error.
I search an easy way to react an this!

Is the only way over the add/datachange events?
On load operations i can use the callback param - and i enjoy this easy way ;-)

BJochen
19 Apr 2011, 6:58 AM
no ideas?

fay
19 Apr 2011, 7:15 AM
Could you try re-phrasing your question? I couldn't understand it!

BJochen
19 Apr 2011, 11:19 PM
Okay i want to realize something like this:

- User fill and submit a form
- Json Store sends the data to the webservice
- Webservice sends answer: Data not valid or Data Vaild (I use the Successproperty and the Messageproperty for this)
- An Messagebox display the Webservice answer

What I search is a easy way to wait for the server response.

For example the Store.load function has a parameter for a callback function, which is called after the server has answered, and i can use this function.

Why has store.add and store.insert no callback function?

khalilm
20 Apr 2011, 12:05 PM
BJochen,

If you are using formPanel for user submission then you can use the submit() function to get your webservice message.

A good example of this can be found here: http://www.sencha.com/learn/Tutorial:Basic_Login

If you are not using a form then you can use Ext.Ajax.request to basically do the same thing. However in this case it is up to you to specify the parameter values.

Khalil