Allow switch widgets to display "key: value" instead of the default "key"
This commit is contained in:
parent
532ba56635
commit
f36664718d
1 changed files with 3 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ module.exports = class Switch extends _widgets_base {
|
|||
_switch:'switch',
|
||||
|
||||
horizontal:false,
|
||||
show_values:false,
|
||||
values:{"Value 1":1,"Value 2":2},
|
||||
value:'',
|
||||
|
||||
|
|
@ -52,7 +53,8 @@ module.exports = class Switch extends _widgets_base {
|
|||
|
||||
for (var k in this.getProp('values')) {
|
||||
this.values.push(this.getProp('values')[k])
|
||||
$(`<div class="value">${iconify(parseFloat(k) != k ? k : this.getProp("values")[k])}</div>`).data({value:this.getProp('values')[k]}).appendTo(this.widget)
|
||||
var the_val = (this.getProp('show_values')) ? ': ' + this.getProp('values')[k] : ''
|
||||
$(`<div class="value">${iconify(parseFloat(k) != k ? k : this.getProp("values")[k]) + the_val}</div>`).data({value:this.getProp('values')[k]}).appendTo(this.widget)
|
||||
}
|
||||
|
||||
this.value = undefined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue