From 7f04b1b6eec3a29548c0d4abc911c61a10a2f64c Mon Sep 17 00:00:00 2001 From: Wes Date: Sat, 21 Jan 2012 16:15:49 +0000 Subject: [PATCH] Copied changes wrt "copying li class to node class" from core lib to example lib. --- example/jquery.jOrgChart.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/example/jquery.jOrgChart.js b/example/jquery.jOrgChart.js index f1df0cb..daec657 100644 --- a/example/jquery.jOrgChart.js +++ b/example/jquery.jOrgChart.js @@ -133,6 +133,7 @@ var $nodeRow = $("").addClass("node-cells"); var $nodeCell = $("").addClass("node-cell").attr("colspan", 2); var $childNodes = $node.children("ul:first").children("li"); + var $nodeDiv; if($childNodes.length > 1) { $nodeCell.attr("colspan", $childNodes.length * 2); @@ -210,8 +211,17 @@ $tbody.append($childNodesRow); } - if ($node.hasClass('collapsed')) { - $nodeRow.nextAll('tr').css('display', 'none'); + // any classes on the LI element get copied to the relevant node in the tree + // apart from the special 'collapsed' class, which collapses the sub-tree at this point + if ($node.attr('class') != undefined) { + var classList = $node.attr('class').split(/\s+/); + $.each(classList, function(index,item) { + if (item == 'collapsed') { + $nodeRow.nextAll('tr').css('display', 'none'); + } else { + $nodeDiv.addClass(item); + } + }); } $table.append($tbody);