collapsing parts of the tree doesn't make sibling trees move

master
Wes 2012-03-16 14:14:54 +00:00
commit fb6808bd07
3 changed files with 467 additions and 473 deletions

View File

@ -1,20 +1,18 @@
/** /**
* jQuery org-chart/tree plugin. * jQuery org-chart/tree plugin.
* *
* Author: Wes Nolte * Author: Wes Nolte
* http://twitter.com/wesnolte * http://twitter.com/wesnolte
* *
* Based on the work of Mark Lee * Based on the work of Mark Lee
* http://www.capricasoftware.co.uk * http://www.capricasoftware.co.uk
* *
* ID implementation fixed by Adrian Hinz * This software is licensed under the Creative Commons Attribution-ShareAlike
* * 3.0 License.
* This software is licensed under the Creative Commons Attribution-ShareAlike *
* 3.0 License. * See here for license terms:
* * http://creativecommons.org/licenses/by-sa/3.0
* See here for license terms: */
* http://creativecommons.org/licenses/by-sa/3.0
*/
(function($) { (function($) {
$.fn.jOrgChart = function(options) { $.fn.jOrgChart = function(options) {
@ -182,16 +180,15 @@
$nodeDiv.click(function() { $nodeDiv.click(function() {
var $this = $(this); var $this = $(this);
var $tr = $this.closest("tr"); var $tr = $this.closest("tr");
$tr.nextAll("tr").fadeToggle("fast");
if($tr.hasClass('contracted')){ if($tr.hasClass('contracted')){
$this.css('cursor','n-resize'); $this.css('cursor','n-resize');
$tr.removeClass('contracted'); $tr.removeClass('contracted').addClass('expanded');
$tr.addClass('expanded'); $tr.nextAll("tr").css('visibility', '');
}else{ }else{
$this.css('cursor','s-resize'); $this.css('cursor','s-resize');
$tr.removeClass('expanded'); $tr.removeClass('expanded').addClass('contracted');
$tr.addClass('contracted'); $tr.nextAll("tr").css('visibility', 'hidden');
} }
}); });
} }

View File

@ -1,20 +1,18 @@
/** /**
* jQuery org-chart/tree plugin. * jQuery org-chart/tree plugin.
* *
* Author: Wes Nolte * Author: Wes Nolte
* http://twitter.com/wesnolte * http://twitter.com/wesnolte
* *
* Based on the work of Mark Lee * Based on the work of Mark Lee
* http://www.capricasoftware.co.uk * http://www.capricasoftware.co.uk
* *
* ID implementation fixed by Adrian Hinz * This software is licensed under the Creative Commons Attribution-ShareAlike
* * 3.0 License.
* This software is licensed under the Creative Commons Attribution-ShareAlike *
* 3.0 License. * See here for license terms:
* * http://creativecommons.org/licenses/by-sa/3.0
* See here for license terms: */
* http://creativecommons.org/licenses/by-sa/3.0
*/
(function($) { (function($) {
$.fn.jOrgChart = function(options) { $.fn.jOrgChart = function(options) {
@ -182,16 +180,15 @@
$nodeDiv.click(function() { $nodeDiv.click(function() {
var $this = $(this); var $this = $(this);
var $tr = $this.closest("tr"); var $tr = $this.closest("tr");
$tr.nextAll("tr").fadeToggle("fast");
if($tr.hasClass('contracted')){ if($tr.hasClass('contracted')){
$this.css('cursor','n-resize'); $this.css('cursor','n-resize');
$tr.removeClass('contracted'); $tr.removeClass('contracted').addClass('expanded');
$tr.addClass('expanded'); $tr.nextAll("tr").css('visibility', '');
}else{ }else{
$this.css('cursor','s-resize'); $this.css('cursor','s-resize');
$tr.removeClass('expanded'); $tr.removeClass('expanded').addClass('contracted');
$tr.addClass('contracted'); $tr.nextAll("tr").css('visibility', 'hidden');
} }
}); });
} }

View File

@ -16,7 +16,7 @@ Features include:
* Easy to style. * Easy to style.
* You can specify that sub-trees should start collapsed, which is useful for very large trees * You can specify that sub-trees should start collapsed, which is useful for very large trees
![jQuery OrgChart](http://i.imgur.com/2OpyG.png "jQuery OrgChart") ![jQuery OrgChart](http://i.imgur.com/T8kKA.png "jQuery OrgChart")
---- ----