You can add an instance of the model to the repository after submitting the form using this code:
onSaveClick: function() { var iForm = this.getFormPanel().getForm(), iValues = iForm.getValues(), iStore = this.getTasksStore(); iStore.add( iValues ); },
This is in the MVC controller, so this is the controller.
To edit the model, you can βbindβ the form to the model instance using loadRecord :
iFormPanel.loadRecord( this.selection );
Then you can update the model instance using updateRecord() :
iFormPanel.getForm().updateRecord();
Just for fun (and how it might help someone), it looks like the following code:
onSaveClick: function() { var iForm = this.getFormPanel().getForm(), iRecord = iForm.getRecord(), iValues = iForm.getValues(); iRecord.set ( iValues ); },
If your store has autoSync: true . The update (or creation) will be called through the configured proxy. If there is no autoSync, you will have to synchronize the repository manually.
source share