1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Select widget: fix bug with deselecting entries programmatically

Previously, it was not possible to deselect entries by editing the tiddler $:/generated-list-demo-state used in the final example of the SelectWidget docs
This commit is contained in:
Jeremy Ruston 2019-10-11 17:46:30 +01:00
parent 81f1e6af4e
commit d30eacc652

View File

@ -96,11 +96,8 @@ SelectWidget.prototype.setSelectValue = function() {
var select = this.getSelectDomNode();
var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
for(var i=0; i < select.children.length; i++){
if(values.indexOf(select.children[i].value) != -1) {
select.children[i].selected = true;
}
select.children[i].selected = values.indexOf(select.children[i].value) !== -1
}
} else {
var domNode = this.getSelectDomNode();
if(domNode.value !== value) {