wesnolte / jOrgChart

A jQuery plugin to draw tree-like structures such as OrgCharts.
992 stars 674 forks source link

Hiding Other Trees #7

Closed kyleknighted closed 12 years ago

kyleknighted commented 12 years ago

Just curious if you've thought about it, plan to implement it, or don't care about the feature. Was curious about opening up a tree branch and all other sibling branches would close, so that way there wouldn't be a slew of open branches if you have a large tree?

kyleknighted commented 12 years ago

After a bit of playing, if you add the below code to your $nodeDiv.click(function() { it should close the other branches. Not the prettiest, and probably a better way to implement, but it does the job I need it do for now.

var $siblingTd = $this.closest('td.node-container'); $siblingTd.siblings().each(function(){ $(this).find('tr.node-cells').siblings().fadeOut("fast"); });

wesnolte commented 12 years ago

Sounds interesting :) I can see how it would be useful but it's quite niche functionality. If another person asks for it then I'll definitely add it. Thanks for the suggestion!