PDA

View Full Version : MVC: Reject Store Changes When Server Returns Exception



azinyama
6 Sep 2012, 1:20 AM
Good all!!!

I have a store that is loading into a grid panel using the row editor plugin. I'm also using Ext.Direct Router.

Question #1:
Ext.Direct uses api, read/create/update/delete. Is there a way of setting create to 'undefined' so that when I add a new row to the grid it does not make a call back to server. I have tried setting it to 'undefined' and removing create, but none of theses options worked.

Question #2:
If there is an exception or error or the server throws an exception and success returns false how do I the reject the changes made from my controller.

Thank you for you help...

mitchellsimoens
17 Sep 2012, 6:59 AM
Extend the direct proxy and use the create method to prevent the call

azinyama
17 Sep 2012, 8:52 AM
Hey!!! Thanks for the reply.

What I did for question #1:

Suspend store sync.
Add a new row to the grid (doesn't fire create direct method)
Resume store sync.

Then when I press update/save on grid row editor, create direct method is fired and record is saved to the database and row id is return to the store.
So the first question I'm clear on.

The second question I'm not.
For example if I have a record in the grid that I want to update; say original text in cell is
'This is azee tesiting'
and I want to change the text to
'This is azinyama testing 1, 2, 3...'

If there is an error server side, the text en the cell remains as 'This is azinyama testing 1, 2, 3...' but will have the red triangle top left.
How, if there is an error server side, do I reject the changes do I return the text in the cell back to 'This is azee testing'???