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

Commit

Permalink
[gui.ajax] FilesList: add bulkUpdating mode to avoid triggering initR…
Browse files Browse the repository at this point in the history
…ows() on each child_added event.
  • Loading branch information
cdujeu committed Dec 4, 2015
1 parent b2b7257 commit 7f2ecc9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/src/plugins/gui.ajax/res/js/ui/prototype/class.FilesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,9 @@ Class.create("FilesList", SelectableElements, {
child.observe("node_replaced", newItem.REPLACE_OBS);
child.observe("node_removed", newItem.REMOVE_OBS);

if(this.bulkUpdating){
return;
}
if(this._sortableTable){
var sortColumn = this.crtContext.getMetadata().get("filesList.sortColumn");
var descending = this.crtContext.getMetadata().get("filesList.descending");
Expand Down Expand Up @@ -1392,8 +1395,18 @@ Class.create("FilesList", SelectableElements, {
}
}
this.initRows();
},

setBulkUpdatingMode: function(){
this.bulkUpdating = true;
},

flushBulkUpdatingMode:function(){
this.bulkUpdating = false;
this.initRows();
if(this._sortableTable){
this._sortableTable.sort(0);
}
},

getRenderer : function(){
Expand Down Expand Up @@ -1443,7 +1456,7 @@ Class.create("FilesList", SelectableElements, {
this.clearParsingCache();
var children = ProtoCompat.map2values(contextNode.getChildren());
var renderer = this.getRenderer();
for (var i = 0; i < children.length ; i++)
for (var i = 0; i < children.length ; i++)
{
var child = children[i];
if(this._rejectNodeByFilters(child)){
Expand Down

0 comments on commit 7f2ecc9

Please sign in to comment.