dropdown: allow resubmitting the same value
This commit is contained in:
parent
5f4c2c60be
commit
b555169cef
3 changed files with 15 additions and 1 deletions
|
|
@ -58,6 +58,12 @@ class Dropdown extends MenuBase {
|
|||
this.setValue(this.values[this.select.selectedIndex], {sync:true, send:true, fromLocal:true})
|
||||
}, {element: this.select})
|
||||
|
||||
this.on('fast-click', (e)=>{
|
||||
// allow resubmitting same value
|
||||
this.select.selectedIndex = -1
|
||||
}, {element: this.select})
|
||||
|
||||
|
||||
this.select.selectedIndex = -1
|
||||
this.selected = -1
|
||||
this.container.classList.add('noselect')
|
||||
|
|
@ -95,6 +101,10 @@ class Dropdown extends MenuBase {
|
|||
this.select.blur()
|
||||
}
|
||||
|
||||
for (var j = 0; j < this.select.options.length; j++) {
|
||||
this.select.options[j].classList.toggle('on', i === j)
|
||||
}
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue