Extjs form.reset() not working as trackResetOnLoad is true

我们两清 提交于 2020-01-06 16:10:35

问题


I have a situation like this.

When I load a form and set values as 'form.setValues(MyObject)', I do not want the form to get dirty. In Order to do that I have set the config 'trackResetOnLoad:true'. My problem is I need to reset the form to its fresh state before I move to new form. form.reset() won't work as the trackResetOnLoad will set the 'originalValue' of each field. Any Idea to reset the page without looping through each field of the form and reset it which brings me huge overhead as too many controls in the form.?

Thanks,

Anish Karunakaran.


回答1:


You could try and load an empty record in the form when wanting to reset it

form.getForm().loadRecord(Ext.create('Application.data.ModelName'));

After doing this, form.isDirty() remains false



来源:https://stackoverflow.com/questions/29007751/extjs-form-reset-not-working-as-trackresetonload-is-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!