Skip to content

Instantly share code, notes, and snippets.

@MeoMix
Created November 10, 2012 00:32
Show Gist options
  • Save MeoMix/4049220 to your computer and use it in GitHub Desktop.
Save MeoMix/4049220 to your computer and use it in GitHub Desktop.
// open/close
open_node : function (obj, callback, skip_animation) {
console.log("Obj:", obj);
obj = this._get_node(obj);
console.log("calling open node", obj);
if(!obj.length) { return false; }
if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
t = this;
if(!this._is_loaded(obj)) {
obj.children("a").addClass("jstree-loading");
this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
}
else {
if(this._get_settings().core.open_parents) {
console.log("going to try opening some nodes");
obj.parentsUntil(".jstree",".jstree-closed").each(function () {
t.open_node(this, false, true);
});
}
if(s) { obj.children("ul").css("display","none"); }
obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
if(s) { obj.children("ul").stop(true, true).slideDown(s, function () { this.style.display = ""; t.after_open(obj); }); }
else { t.after_open(obj); }
this.__callback({ "obj" : obj });
if(callback) { callback.call(); }
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment