From 73bd0b04ec59ca473afc79a736758e920606f7d3 Mon Sep 17 00:00:00 2001 From: Fritz Zaucker Date: Fri, 3 Nov 2023 17:29:14 +0100 Subject: [PATCH] Fix setting comboBox data --- CHANGES | 2 ++ .../source/class/callbackery/ui/form/Auto.js | 22 +++++++++++++++---- .../class/callbackery/ui/plugin/Form.js | 9 +++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 9504b1c..27af477 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + - Fix update comboBox data + 0.46.5 2023-06-28 08:29:18 +0200 Tobias Oetiker - fixed regression in abstractform (missing signature) diff --git a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js index 34ec4f8..e8f18c1 100644 --- a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js +++ b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js @@ -275,8 +275,6 @@ qx.Class.define("callbackery.ui.form.Auto", { this); var formWgt = new (formRenderer)(form); - var fl = formWgt.getLayout(); - this._add(formWgt); }, @@ -359,7 +357,6 @@ qx.Class.define("callbackery.ui.form.Auto", { */ setSelectBoxData : function(box, data) { let model; - if (data.length == 0) { model = qx.data.marshal.Json.createModel([ { title : '', @@ -383,7 +380,9 @@ qx.Class.define("callbackery.ui.form.Auto", { let oldItem = ctrl.getValue(); let newItem = null; if (oldItem){ - newItem = lookup[oldItem.getKey()]; + if (oldItem.getKey) { + newItem = lookup[oldItem.getKey()]; + } if (!newItem){ console.warn(`SelectBox ${box} has no entry for ${oldItem.getKey()} selecting first item.`); } @@ -395,6 +394,21 @@ qx.Class.define("callbackery.ui.form.Auto", { }, + /** + * set the data in a combobox + * + * @param box {var} TODOC + * @param widget {var} TODOC + * @param data {var} TODOC + */ + setComboBoxData : function(box, data) { + let ctrl = this._boxCtrl[box]; + this._settingData++; + ctrl.setModel(qx.data.marshal.Json.createModel(data)); + this._settingData--; + }, + + /** * load new data into a model * if relax is set unknown properties will be ignored diff --git a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/plugin/Form.js b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/plugin/Form.js index 79c98da..f4dc7bf 100644 --- a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/plugin/Form.js +++ b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/plugin/Form.js @@ -254,13 +254,20 @@ qx.Class.define("callbackery.ui.plugin.Form", { if (!s.key){ return; } - if (s.widget == 'selectBox' || s.widget == 'comboBox'){ + if (s.widget == 'selectBox'){ if (s.reloadOnFormReset !== false) { this._reconfSelectBoxRunning++; this._form.setSelectBoxData(s.key,s.cfg.structure); this._reconfSelectBoxRunning--; } } + if (s.widget == 'comboBox'){ + if (s.reloadOnFormReset !== false) { + this._reconfSelectBoxRunning++; + this._form.setComboBoxData(s.key, s.cfg.structure); + this._reconfSelectBoxRunning--; + } + } if (s.set) { if ('value' in s.set){ delete s.set.value; // do NOT change the value of anything.