View Full Version : Update store after CRUD

11 Feb 2012, 1:51 PM
In a controller I have an event handler for a form's button. Also I have a model instance called "customer" with an ajax json proxy with "Create/Update/Insert/Delete" urls configured, and it works ok.

I use this form to edit a record (model) part of a store. When I do an Update operation, the grid that shows the store is updated automatically, but on Inserts, I'm forced to do "this.getMyJsonStoreStore().load()" on the "success" event.

Is there an transparent way to notify the store about the new record?. If not, how can I determine if the model was Updated/Deleted or Created (I only need to load the store after Insert or Delete, not for Updates).

This is my code so far:

onSubmit: function(button) { var win = button.up('frmCustomer');
frm = win.getForm();
customer = frm.getRecord();
success: function(customer){
failure: function(customer){
Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
scope: this

11 Feb 2012, 6:42 PM
after save, insert the record in the store, or just before saving. ur choice, but no need to reload the store,

11 Feb 2012, 7:48 PM
i have same problem :-|
i did "autoLoad: true" in my store , but didn't work .

12 Feb 2012, 2:18 AM
The problem was that I was using doing CRUD operation in a Model, then synchronizing the Store by hand.

Everything was fixed after working with the Store instead of the model.