From f0755d8e0c1936e21871ac3a4531bd6ca40a94f6 Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <legac@cppm.in2p3.fr> Date: Tue, 27 Jan 2015 18:59:36 +0100 Subject: [PATCH] The dict method setValue load the default dict when the value is null. In this version the height of the dict field has to be defined. To be removed when using FieldContainer. --- models/ui_new_fields.py | 1 + static/plugin_dbui/src/form/field/Dict.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/models/ui_new_fields.py b/models/ui_new_fields.py index e57920b0..7bf12593 100644 --- a/models/ui_new_fields.py +++ b/models/ui_new_fields.py @@ -10,6 +10,7 @@ fieldsModifier = dbui.FieldsModifier('new_fields') fieldsModifier.configure_field('dictionary', headers=['foo', 'faa'], modifyKeys=True, + height=150, dictCfg={"string": "test", "boolean": False, "integer": 0, diff --git a/static/plugin_dbui/src/form/field/Dict.js b/static/plugin_dbui/src/form/field/Dict.js index 769fcc6d..fcc8dfa2 100644 --- a/static/plugin_dbui/src/form/field/Dict.js +++ b/static/plugin_dbui/src/form/field/Dict.js @@ -316,6 +316,7 @@ Ext.define('App.form.field.Dict', { /** * Set the value for the dictionary. + * Loadd the default dictionary when the value is null. * * @param {Object} value * A key, value object which is loaded in the dictioanry. @@ -323,7 +324,7 @@ Ext.define('App.form.field.Dict', { */ setValue: function (value) { - var source = Ext.apply({}, value, this.dictCfg); + var source = value || this.dictCfg; this.grid.setSource(source); return this.callParent([source]); -- GitLab