Extjs form.reset()不能正常运行,因为trackResetOnLoad为true [英] Extjs form.reset() not working as trackResetOnLoad is true

查看:214
本文介绍了Extjs form.reset()不能正常运行,因为trackResetOnLoad为true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的情况.

当我加载表单并将值设置为"form.setValues(MyObject)"时,我不希望表单弄脏.为了做到这一点,我设置了配置'trackResetOnLoad:true'. 我的问题是,在移至新表格之前,需要将表格重置为新状态. form.reset()无效,因为trackResetOnLoad会设置每个字段的原始值". 有什么想法可以重置页面而不循环遍历表单的每个字段并重置页面,这给我带来了巨大的开销,因为表单中的控件太多了.

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.?

谢谢

阿尼什(Anish Karunakaran).

Anish Karunakaran.

推荐答案

要重置记录,您可以尝试在表单中加载空记录

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

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

执行此操作后,form.isDirty()保持为false

After doing this, form.isDirty() remains false

这篇关于Extjs form.reset()不能正常运行,因为trackResetOnLoad为true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆