mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-25 08:05:02 +00:00
* Fixes #8092 SelectWidget does not work with multiple options organised into group * Consolidate variables * Apply suggestion from @saqimtiaz * Update core/modules/widgets/select.js Co-authored-by: Mario Pietsch <pmariojo@gmail.com> * added release note * chore: lint fixes --------- Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com> Co-authored-by: Mario Pietsch <pmariojo@gmail.com>
This commit is contained in:
@@ -121,9 +121,18 @@ SelectWidget.prototype.setSelectValue = function() {
|
|||||||
if (this.selectMultiple) {
|
if (this.selectMultiple) {
|
||||||
value = value === undefined ? "" : value;
|
value = value === undefined ? "" : value;
|
||||||
var select = this.getSelectDomNode();
|
var select = this.getSelectDomNode();
|
||||||
var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
|
var child,
|
||||||
|
values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
|
||||||
for(var i=0; i < select.children.length; i++){
|
for(var i=0; i < select.children.length; i++){
|
||||||
select.children[i].selected = values.indexOf(select.children[i].value) !== -1
|
child=select.children[i];
|
||||||
|
if(child.children.length === 0){
|
||||||
|
child.selected = values.indexOf(child.value) !== -1;
|
||||||
|
} else {
|
||||||
|
// grouped options
|
||||||
|
for(var y=0; y < child.children.length; y++){
|
||||||
|
child.children[y].selected = values.indexOf(child.children[y].value) !== -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var domNode = this.getSelectDomNode();
|
var domNode = this.getSelectDomNode();
|
||||||
|
|||||||
10
editions/tw5.com/tiddlers/releasenotes/5.4.0/#8093.tid
Normal file
10
editions/tw5.com/tiddlers/releasenotes/5.4.0/#8093.tid
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
title: $:/changenotes/5.4.0/#8093
|
||||||
|
description: Fixes SelectWidget does not work with multiple options organised into group - issue #8092
|
||||||
|
release: 5.4.0
|
||||||
|
tags: $:/tags/ChangeNote
|
||||||
|
change-type: bugfix
|
||||||
|
change-category: widget
|
||||||
|
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/issues/8093
|
||||||
|
github-contributors: buggyj
|
||||||
|
|
||||||
|
Fixed SelectWidget does not work with multiple options organised into group.
|
||||||
Reference in New Issue
Block a user