I got a Ext.form.Basic
with the trackResetOnLoad
:true
config.
When I call reset()
on a field it gets its values from the form setValues()
method.
How do I reset my fields now?
When I just do field.setValue('')
the form marks it as invalid because the field is required.
Thanks in advance.
You have to manually reset all of the originValues
of all fields (and some other)
This snipped will do this
var items = form.getForm().getFields().items,
i = 0,
len = items.length;
for(; i < len; i++) {
var c = items[i];
c.value = '';
if(c.mixins && c.mixins.field && typeof c.mixins.field['initValue'] == 'function'){
c.mixins.field.initValue.apply(c);
c.wasDirty = false;
}
}
working example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With