Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Buffer tree_change events to avoid multiple resize calls during reload
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Aug 28, 2014
1 parent 9158301 commit 8215b0d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/src/plugins/gui.ajax/res/js/lib/webfx/xtree.js
Expand Up @@ -165,6 +165,15 @@ function WebFXTreeAbstractNode(sText, sAction) {
webFXTreeHandler.all[this.id] = this;
}

function WebFXTreeBufferTreeChange(){
if (window.webfxtreebufferTimer) {
window.clearTimeout(window.webfxtreebufferTimer);
}
window.webfxtreebufferTimer = window.setTimeout(function(){
document.fire("ajaxplorer:tree_change");
}, 200);
}

/*
* To speed thing up if you're adding multiple nodes at once (after load)
* use the bNoIdent parameter to prevent automatic re-indentation and call
Expand Down Expand Up @@ -254,7 +263,7 @@ WebFXTreeAbstractNode.prototype.add = function (node, bNoIdent) {
}, 100);
}
}
document.fire("ajaxplorer:tree_change");
WebFXTreeBufferTreeChange();
return node;
};

Expand Down Expand Up @@ -402,7 +411,7 @@ WebFXTreeAbstractNode.prototype.doExpand = function() {
if (webFXTreeConfig.usePersistence) {
webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '1');
}
document.fire("ajaxplorer:tree_change");
WebFXTreeBufferTreeChange();
} ;

WebFXTreeAbstractNode.prototype.doCollapse = function() {
Expand All @@ -414,7 +423,7 @@ WebFXTreeAbstractNode.prototype.doCollapse = function() {
if (webFXTreeConfig.usePersistence) {
webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '0');
}
document.fire("ajaxplorer:tree_change");
WebFXTreeBufferTreeChange();
} ;

WebFXTreeAbstractNode.prototype.expandAll = function() {
Expand Down

0 comments on commit 8215b0d

Please sign in to comment.