From 4bfa80a1f820189a34d9fc992586e2ed25107136 Mon Sep 17 00:00:00 2001 From: tux091 <renaud.legac@free.fr> Date: Thu, 29 Sep 2011 22:22:10 +0200 Subject: [PATCH] Bug fixed: get values for fields embedded in composite field. --- static/plugin_dbui/src/appform.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/static/plugin_dbui/src/appform.js b/static/plugin_dbui/src/appform.js index 04e35195..9367f50c 100644 --- a/static/plugin_dbui/src/appform.js +++ b/static/plugin_dbui/src/appform.js @@ -290,7 +290,7 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, { updateRecord: function (record) { var combo, - combos, + fields, i, item, rec, @@ -304,12 +304,22 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, { } } + // handle field embedded in composite fields + fields = this.findByType('compositefield'); + for (i = 0; i < fields.length; i += 1) { + fields[i].items.eachKey(function(key, field) { + if (field.isDirty()) { + record.set(field.getName(), field.getValue()); + } + }); + } + // For foreign key, the record contains the valueField // as well as the displayField. Previous action update the valueField // but note the display field. The next line append the displayField - combos = this.findByType('xcombobox'); - for (i = 0; i < combos.length; i += 1) { - combo = combos[i]; + fields = this.findByType('xcombobox'); + for (i = 0; i < fields.length; i += 1) { + combo = fields[i]; rec = combo.findRecord(combo.valueField, combo.getValue()); record.set(combo.displayField, rec.get(combo.displayField)); } -- GitLab