mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Fixes #8092 SelectWidget does not work with multiple options organised into group
This commit is contained in:
parent
31ec1bdd50
commit
f9cec3a7d2
@ -122,8 +122,17 @@ SelectWidget.prototype.setSelectValue = function() {
|
|||||||
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 values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
|
||||||
|
var child;
|
||||||
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();
|
||||||
|
Loading…
Reference in New Issue
Block a user