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

Commit

Permalink
Make sure to reScanChildrenPanes when using additional_content config…
Browse files Browse the repository at this point in the history
…uration. Use _registerObserver at most tomake sure observers are removed at component destruction.
  • Loading branch information
cdujeu committed Jul 25, 2014
1 parent 049cbe9 commit 9d89940
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

Expand Up @@ -116,6 +116,7 @@ Class.create("AjxpPane", {
}
}.bind(this));
if(change){
this.scanChildrenPanes(this.htmlElement, true);
this.resize();
this.reorderContents();
}
Expand Down
Expand Up @@ -65,25 +65,26 @@ Class.create("FetchedResultPane", FilesList, {
}, ajxpOptions));

if(this.options.updateGlobalContext){
dataModel.observe("selection_changed", function(){
this._registerObserver(dataModel, "selection_changed", function(){
if(!this._dataLoaded) return;
var selectedNodes = this._dataModel.getSelectedNodes();
if(selectedNodes){
ajaxplorer.getContextHolder().setSelectedNodes(selectedNodes, this);
}
}.bind(this));
}.bind(this), true);
}else if(this.options.selectionChangeCallback){
dataModel.observe("selection_changed", this.options.selectionChangeCallback);
this._registerObserver(dataModel, "selection_changed", this.options.selectionChangeCallback, true);
}

if(this.options.forceClearOnRepoSwitch){
document.observe("ajaxplorer:repository_list_refreshed", function(){
var repoSwitchObserver = function(){
this._rootNode.clear();
this._dataLoaded = false;
if(this.htmlElement && this.htmlElement.visible()){
this.showElement(true);
}
}.bind(this));
}.bind(this);
this._registerObserver(document, "ajaxplorer:repository_list_refreshed", repoSwitchObserver);
}

this.hiddenColumns.push("is_file");
Expand All @@ -92,13 +93,13 @@ Class.create("FetchedResultPane", FilesList, {
mainElementName.addClassName('class-FetchedResultPane');

if(ajxpOptions.reloadOnServerMessage){
ajaxplorer.observe("server_message", function(event){
this._registerObserver(ajaxplorer, "server_message", function(event){
var newValue = XPathSelectSingleNode(event, ajxpOptions.reloadOnServerMessage);
if(newValue) this.reloadDataModel();
}.bind(this));
ajaxplorer.observe("server_message:" + ajxpOptions.reloadOnServerMessage, function(){
}.bind(this), true);
this._registerObserver(ajaxplorer, "server_message:" + ajxpOptions.reloadOnServerMessage, function(){
this.reloadDataModel();
}.bind(this));
}.bind(this), true);
}

if(ajxpOptions.containerDroppableAction){
Expand Down

0 comments on commit 9d89940

Please sign in to comment.