Commit 08ded6da authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update Ext.form.Panel to fix a bug in setAction#create.

parent ad3380aa
......@@ -327,26 +327,31 @@ Ext.define('Dbui.form.Panel', {
// load an empty record filled with default values
// NOTE ExtJS 6.0.1
// - The method record.getData() contains the value the fiels id
// and for the field with default value but not for the others.
// NOTE ExtJS 6x
// - The method record.getData() contains the value for the field
// id and for the field with default value but not for the others.
// - The form can contain values for the other fields due to
// previous operation. The previous values are not overwritten
// by the methos form.loadRecord or form.setValues.
// by the method form.loadRecord or form.setValues.
// - The solution is to defined a data block with values for
// all fields and toload it using form.setValues.
// - The form.reset is required to remove non valid flags.
// all fields and to load it using form.setValues.
// - Clear invalid field
newRecord = me.store.getProxy().getModel().create();
data = {};
fields = newRecord.getFields();
for (i = 0; i < fields.length; i += 1) {
name = fields[i].getName();
data[name] = newRecord.get(name);
}
newRecord.getFields().forEach(function (field) {
var name = field.getName();
data[name] = newRecord.get(name);
});
form.setValues(data);
form.reset();
form.getFields().each(function (field) {
field.clearInvalid();
return true;
});
break;
case 'destroy':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment