only sync widgets that are mounted, fixes #3

This commit is contained in:
jean-emmanuel 2016-02-12 01:22:16 +01:00
parent 289bc6a803
commit 56d30a411f

View file

@ -92,21 +92,21 @@ init = function(session,callback) {
sync = function() {
$.each(__widgets__,function(i,widget) {
if (widget.length>1) {
var script =''
var closureSync = function(x) {
return function() {
var v = widget[x].getValue()
for (k=0;k<widget.length;k++) {
if (x!=k) {
widget[k].setValue(v,false,false)
if (document.body.contains(widget[k][0].parentNode))
widget[k].setValue(v,false,false)
}
}
}
}
for (j in widget) {
widget[j].off('ssync').on('sync',closureSync(j))
widget[j].off('sync').on('sync',closureSync(j))
}