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', { ...@@ -327,26 +327,31 @@ Ext.define('Dbui.form.Panel', {
// load an empty record filled with default values // load an empty record filled with default values
// NOTE ExtJS 6.0.1 // NOTE ExtJS 6x
// - The method record.getData() contains the value the fiels id // - The method record.getData() contains the value for the field
// and for the field with default value but not for the others. // id and for the field with default value but not for the others.
// - The form can contain values for the other fields due to // - The form can contain values for the other fields due to
// previous operation. The previous values are not overwritten // 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 // - The solution is to defined a data block with values for
// all fields and toload it using form.setValues. // all fields and to load it using form.setValues.
// - The form.reset is required to remove non valid flags. // - Clear invalid field
newRecord = me.store.getProxy().getModel().create(); newRecord = me.store.getProxy().getModel().create();
data = {}; data = {};
fields = newRecord.getFields(); newRecord.getFields().forEach(function (field) {
for (i = 0; i < fields.length; i += 1) { var name = field.getName();
name = fields[i].getName(); data[name] = newRecord.get(name);
data[name] = newRecord.get(name); });
}
form.setValues(data); form.setValues(data);
form.reset();
form.getFields().each(function (field) {
field.clearInvalid();
return true;
});
break; break;
case 'destroy': 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