Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting comboBox data #219

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading