View Full Version : getForm().loadRecord() -> dirty issue

peter seliger
28 Oct 2013, 4:11 AM
dear community,

my activities are:

after loading data in my formpanel via getForm().loadRecord(record) i store the record in a local variable after the even "dirtychange"
after loading my form with other data i wanna restore the stored data using the local variable
what i wanna have:
my form should have the same dirty status as after activity 1
my form should fire the event "dirtychange" with dirty=false on take back data modification on my form
my activities 1 and 2 work fine but after loading the local variable with
getForm().loadRecord(<local variable>) the dirty status on "dirtychange" does not work

28 Oct 2013, 11:19 AM
If your form is configured with trackResetOnLoad:true, then after loadRecord() you will have fields' defaultValues to be equal to values in record. Unfortunately, setValues resets those defaultValues too. You should consider switching off trackResetOnLoad before step 2.
If you do this, then you can simply call reset() instead of loadRecord(<local variable>). Note: this will erase all data entered between steps 1 and 2 and after step 2.