mutli[toggle|push] compatible with plot
This commit is contained in:
parent
c7ed97e282
commit
d435d067ae
3 changed files with 74 additions and 0 deletions
|
|
@ -33,6 +33,8 @@ module.exports.create = function(widgetData,container) {
|
|||
`),
|
||||
$document = $(document)
|
||||
|
||||
widget.value = []
|
||||
|
||||
for (var i=0;i<widgetData.matrix[0]*widgetData.matrix[1];i++) {
|
||||
var data = {
|
||||
type:'push',
|
||||
|
|
@ -48,8 +50,23 @@ module.exports.create = function(widgetData,container) {
|
|||
element[0].setAttribute('style',`width:${100/widgetData.matrix[0]}%`)
|
||||
element[0].classList.add('not-editable')
|
||||
|
||||
widget.value[i] = widgetData.off
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
widget.on('sync',function(e,id,w){
|
||||
if (id==widgetData.id) return
|
||||
widget.value[w.parent().index()] = w.getValue()
|
||||
widget.trigger('sync',[widgetData.id,widget])
|
||||
})
|
||||
|
||||
|
||||
widget.getValue = function(){
|
||||
return widget.value
|
||||
}
|
||||
|
||||
widget.delegateDrag()
|
||||
|
||||
return widget
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ module.exports.create = function(widgetData,container) {
|
|||
`),
|
||||
$document = $(document)
|
||||
|
||||
widget.value = []
|
||||
|
||||
for (var i=0;i<widgetData.matrix[0]*widgetData.matrix[1];i++) {
|
||||
var data = {
|
||||
type:'toggle',
|
||||
|
|
@ -48,8 +50,23 @@ module.exports.create = function(widgetData,container) {
|
|||
element[0].setAttribute('style',`width:${100/widgetData.matrix[0]}%`)
|
||||
element[0].classList.add('not-editable')
|
||||
|
||||
widget.value[i] = widgetData.off
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
widget.on('sync',function(e,id,w){
|
||||
if (id==widgetData.id) return
|
||||
widget.value[w.parent().index()] = w.getValue()
|
||||
widget.trigger('sync',[widgetData.id,widget])
|
||||
})
|
||||
|
||||
|
||||
widget.getValue = function(){
|
||||
return widget.value
|
||||
}
|
||||
|
||||
widget.delegateDrag()
|
||||
|
||||
return widget
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue