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
fix-syncer
Jeremy Ruston 2019-10-11 17:46:30 +01:00
rodzic 81f1e6af4e
commit d30eacc652
1 zmienionych plików z 1 dodań i 4 usunięć

Wyświetl plik

@ -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) {