diff --git a/R/treeWeightD3.R b/R/treeWeightD3.R index daf0d3e892c69dc8a287ba779bdd5210d3400c70..6af4a4ac0495f25dc847f471a4200f75c730deb8 100644 --- a/R/treeWeightD3.R +++ b/R/treeWeightD3.R @@ -12,6 +12,7 @@ treeWeightD3 <- function(message, conditions,levels,nodeFind, width = NULL, heig message = message, conditions = conditions, + numberConditions = length(conditions), levels = levels, nodeFind = nodeFind ) diff --git a/inst/htmlwidgets/treeWeightD3.js b/inst/htmlwidgets/treeWeightD3.js index 9e73e5a2397a4c26991eec36f141507b3c8f01c7..edb591134bb8ca60aa0aaece37cd20442215f4c8 100644 --- a/inst/htmlwidgets/treeWeightD3.js +++ b/inst/htmlwidgets/treeWeightD3.js @@ -20,8 +20,16 @@ HTMLWidgets.widget({ while (el.firstChild) { el.removeChild(el.firstChild); } + var conditions; - var conditions = x.conditions; + // if one condition + if(x.numberConditions == 1){ + alert("numberConditions == 1"); + conditions =new Array (x.conditions); + } + else{ + conditions = x.conditions; + } // Create Condition Menu var menu = document.createElement("div");