rosebrit3
rosebrit3

Reputation: 523

Form reload in EXTJS4

I have a form with a save, clear and reload button. The clear button works by clearing the form, using the reset method. But on clicking, the reload button, the form should be loaded back with the data that was typed in the form before clicking the clear button. So, how could this be done? Thanks in advance.

Upvotes: 1

Views: 4867

Answers (2)

hopper
hopper

Reputation: 13390

Take a look at the form's getValues() and setValues() methods. When the clear button is clicked, you can use var oldValues = form.getValues() to store the current field values. Then when the reload button is clicked, you can restore the values via form.setValues(oldValues).

Upvotes: 1

sha
sha

Reputation: 17860

Check out loadRecord() method:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic-method-loadRecord

Upvotes: 2

Related Questions