我在表单中使用了一个非常简单的 RadioGroup。我的表单通过 form.loadRecord() 方法填充了一条记录,然后我使用 form.updateRecord() 根据表单中的值更新记录。它有效,我可以加载记录并保存它们,此时没问题。
当我想使用它的方法 isDirty() 检查表单的脏状态时,就会出现问题。它总是“真实的”。我基本上知道为什么,那是因为 RadioGroup 的原始值始终等于“0”,并且不是由 loadRecord() 设置的(它只是将值应用于 adhoc radiogroup 的子级)。
-> form.getFields().items[10].originalValue = 评分:“0”
-> form.getFields().items[10].getValue() = 评分:“3”
我应该补充一点,其他字段中的 NONE 都是脏的(trackResetOnLoad 在表单上设置为 true,这允许在加载记录时重置表单)。此问题仅发生在无线电组中。
这是我使用的无线电组的代码。我试图将“名称:'评级'”添加到无线电组,但它崩溃了(显然它在 ExtJS 3.x 中工作)。
xtype : 'radiogroup',
fieldLabel: 'Rating',
items: [
{
boxLabel : 'Zero',
name : 'Rating',
inputValue: "0"
}, {
boxLabel : 'One',
name : 'Rating',
inputValue: "1"
}, {
boxLabel : 'Two',
name : 'Rating',
inputValue: "3"
}
]
谢谢你的帮助!