Reset Form Fixed Record Values ​​- ExtJS 4.2

I have a Grid panel containing records that in a click will be loaded onto the form panel for editing.

In "closing" our form panel, we call myForm.getForm.reset (), which appears to be reset, but the values ​​in the form fields themselves are saved.

// Load record
me.down('form').loadRecord(record);
// Close
me.down('form').getForm().reset() or me.down('form').reset()

Please advise how to clear the values ​​in the form after resetting our record.

+2
source share
5 answers

You have trackResetOnLoadset to true to form? If so, then what you really want is false.

+5
source

, resetRecord 'reset()' , loadRecord.

:

me.down('form').getForm().reset(true)
+3

, . :

 Ext.override(Ext.form.Panel, {
     clearForm:function(){
         Ext.each(this.getForm().getFields().items, function(field){
                field.setValue('');
         });
     }
});

, :

myForm.clearForm()

myForm - .

reset() .

+2

trackResetOnLoad = true (, "dirtychange" ), , , var originalValues = myForm.getFieldValues(); myForm.setValues(originalValues); myForm.reset(...);

+1
source

You can try this ...

this.up('form').getForm().reset();
-1
source

All Articles