While working on some requirements, there was a need where in for a form when some values were entered, after taking some actions the entered values of the form were now suppose to be treated as the default values and not the changed values. In-short their dirty flags need to be cleared. (When ever we change a form field its dirty flag is set indicating that is has been modified.)
In order to clear the dirty flags of the fields we need to set the trackResetOnLoad=true for the formPanel.
The form Panel does not have such a config and we need to extend it in order to set this field:
constructor : function(config) {
config = config || {};
config.trackResetOnLoad = true;
this.callParent([config]);
},
config = config || {};
config.trackResetOnLoad = true;
this.callParent([config]);
},
After this wherever we want to clear the dirty flags of the fields, we would need to use:
//to clear the dirty flag
var baseForm=this.getForm();
baseForm.setValues(baseForm.getValues());
baseForm.setValues(baseForm.getValues());
:).. Finally solved!!...
Great Post. Really helped
ReplyDeleteThanx Bechan :)
DeleteVery tricky
ReplyDeleteThanks Snehal :)
Your Welcome Krishan :)
DeleteThanks Snehal !!! This issue was a real pain in the neck.
ReplyDeleteI had to go through the same pain :P.. Good it helped you.
DeleteWorking great.....!
ReplyDeletegood tip. thanks!
ReplyDelete