PDA

View Full Version : [MVC] How i can get the store response text and give an alert?



rafaelrp
9 May 2013, 6:35 AM
Hello!

I have a store that will have items inserted, how i can get the store response text and give an alert?


Here is the code


vincServ: function(button){
var win = button.up('window');
var form = win.down('form');
var record = form.getRecord();
var values = form.getValues();

this.getServCliStore().create(values);

win.close();
},


Thanks ! ~o)

rafaelrp
10 May 2013, 12:02 PM
up! :)

slemmon
13 May 2013, 7:53 AM
I'm not sure what you mean my store response text. Can you elaborate?

rafaelrp
13 May 2013, 10:25 AM
In my "this.getServCliStore().create(values);" function i have a json response like this:

{"success":true,"message":"Success!"}

I need to get this response text and i need to show an alert, can i do this with a callback in the create() function?


Thanks!

slemmon
13 May 2013, 3:52 PM
Yeah, you should be able to. Check out the params passed to the callback:
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.Operation-cfg-callback

The second param is the operation and I believe will have the raw response if memory serves.