View Full Version : Binding store to form

24 Jun 2012, 10:55 PM
It is possible to bind store record to form? I want save form using store.sync(), to save only changed record. Or is other way to save only changed form fields?

25 Jun 2012, 2:05 AM
You can load a record to the form using:

loadRecord( aRecord );

Then once you want to save the record (my form is in this.view):

onSaveClick: function()
if ( this.view.getForm().isValid() )
var iRecord = this.view.getForm().getRecord(),
iValues = this.view.getForm().getValues();

// Load the new values into the record (this will trigger autosync for modified records)
iRecord.set( iValues );

If you don't have autosync set to true, just call store.sync()

27 Jun 2012, 11:38 PM
I found solution. LoadRecord() bind record from store to form, but for submit better is use form.getForm().updateRecord() and then store.sync();