Skip to content

Commit

Permalink
Fix setting comboBox data (#219)
Browse files Browse the repository at this point in the history
Co-authored-by: Tobias Oetiker <[email protected]>
  • Loading branch information
zaucker and oetiker authored Nov 27, 2023
1 parent 48fcb96 commit 37d40d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
16 changes: 5 additions & 11 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

- Fix update comboBox data

0.47.9 2023-10-26 10:05:30 +0200 Tobias Oetiker <[email protected]>

- better fix, based on https://github.com/qooxdoo/qooxdoo/pull/10632
Expand Down Expand Up @@ -81,20 +84,11 @@

- these changes are necessary to make callbackery work with qx8

0.45.0 2023-05-23 12:05:16 +0200 Tobias Oetiker <[email protected]>

-

0.45.0 2023-05-23 12:05:01 +0200 Tobias Oetiker <[email protected]>

-
=======
0.45.1 2023-05-08 10:52:48 +0200 Tobias Oetiker <[email protected]>
>>>>>>> 93b1caf4debb55a06a72ad1d38134bb1f4173bf4

- Reload CardList on action response

0.45.0 2023-03-30 09:13:03 +0200 Tobias Oetiker <[email protected]>
0.45.0 2023-05-23 12:05:16 +0200 Tobias Oetiker <[email protected]>

- new widget attribute spellcheck which allows to enable
spellcheckers like languagetool in textareas or normal text widets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,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 : '',
Expand All @@ -381,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.`);
}
Expand All @@ -393,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 37d40d1

Please sign in to comment.