treeTable plugin recursive expand and collapse issue
treeTable is a very simple jQuery plugin that renders tabular data in a tree format, but it(latest version 2.3 at the time of writing) has a few bugs one of it is its expand and collapse function are not recursive as they were claimed.
Here are two new collapse and expand functions which really are recursive, feel free to use.
// Recursively hide all node's children in a tree
// modified by http://cleancode.co.nz, current collapse is not recursive
$.fn.Rcollapse = function() {
$(this).removeClass("expanded").addClass("collapsed");
childrenOf($(this)).each(function() {
initialize($(this));
if ($(this).is(".parent")) {
$(this).Rcollapse();
}
this.style.display = "none"; // Performance! $(this).hide() is slow...
});
return this;
};
// Recursively show all node's children in a tree
// modified by http://cleancode.co.nz, current expand is not recursive
$.fn.Rexpand = function() {
$(this).removeClass("collapsed").addClass("expanded");
childrenOf($(this)).each(function() {
initialize($(this));
if ($(this).is(".parent")) {
$(this).Rexpand();
}
// this.style.display = "table-row"; // Unfortunately this is not possible with IE 🙁
$(this).show();
});
return this;
};
Tags: JQuery

You are so awsoeme for helping me solve this mystery.