Merge pull request #4 from neilbowers/master

Bugfixes related to setting of cursor on parent nodes
master
Wes 2012-02-06 07:29:12 -08:00
commit 2ba68bd3bb
2 changed files with 38 additions and 24 deletions

View File

@ -149,19 +149,23 @@
$nodeDiv = $("<div>").addClass("node").append($nodeContent); $nodeDiv = $("<div>").addClass("node").append($nodeContent);
// Expand and contract nodes // Expand and contract nodes
$nodeDiv.click(function() { if ($childNodes.length > 0) {
var $this = $(this); $nodeDiv.click(function() {
var $tr = $this.closest("tr"); var $this = $(this);
$tr.nextAll("tr").fadeToggle("fast"); 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.addClass('expanded'); $tr.removeClass('contracted');
}else{ $tr.addClass('expanded');
$this.css('cursor','s-resize'); }else{
$tr.addClass('contracted'); $this.css('cursor','s-resize');
} $tr.removeClass('expanded');
}); $tr.addClass('contracted');
}
});
}
$nodeCell.append($nodeDiv); $nodeCell.append($nodeDiv);
$nodeRow.append($nodeCell); $nodeRow.append($nodeCell);
@ -218,6 +222,9 @@
$.each(classList, function(index,item) { $.each(classList, function(index,item) {
if (item == 'collapsed') { if (item == 'collapsed') {
$nodeRow.nextAll('tr').css('display', 'none'); $nodeRow.nextAll('tr').css('display', 'none');
$nodeRow.removeClass('expanded');
$nodeRow.addClass('contracted');
$nodeDiv.css('cursor','s-resize');
} else { } else {
$nodeDiv.addClass(item); $nodeDiv.addClass(item);
} }

View File

@ -149,19 +149,23 @@
$nodeDiv = $("<div>").addClass("node").append($nodeContent); $nodeDiv = $("<div>").addClass("node").append($nodeContent);
// Expand and contract nodes // Expand and contract nodes
$nodeDiv.click(function() { if ($childNodes.length > 0) {
var $this = $(this); $nodeDiv.click(function() {
var $tr = $this.closest("tr"); var $this = $(this);
$tr.nextAll("tr").fadeToggle("fast"); 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.addClass('expanded'); $tr.removeClass('contracted');
}else{ $tr.addClass('expanded');
$this.css('cursor','s-resize'); }else{
$tr.addClass('contracted'); $this.css('cursor','s-resize');
} $tr.removeClass('expanded');
}); $tr.addClass('contracted');
}
});
}
$nodeCell.append($nodeDiv); $nodeCell.append($nodeDiv);
$nodeRow.append($nodeCell); $nodeRow.append($nodeCell);
@ -218,6 +222,9 @@
$.each(classList, function(index,item) { $.each(classList, function(index,item) {
if (item == 'collapsed') { if (item == 'collapsed') {
$nodeRow.nextAll('tr').css('display', 'none'); $nodeRow.nextAll('tr').css('display', 'none');
$nodeRow.removeClass('expanded');
$nodeRow.addClass('contracted');
$nodeDiv.css('cursor','s-resize');
} else { } else {
$nodeDiv.addClass(item); $nodeDiv.addClass(item);
} }