Browse Source

Merge pull request #6447 from buinsky/master

WebUI: Improve performance of updating 'progress' column
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
922fec44d2
  1. 26
      src/webui/www/public/scripts/dynamicTable.js

26
src/webui/www/public/scripts/dynamicTable.js

@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
**************************************************************/
var DynamicTableHeaderContextMenuClass = null;
var ProgressColumnWidth = -1;
var DynamicTable = new Class({
@ -851,25 +852,34 @@ var TorrentsTable = new Class({ @@ -851,25 +852,34 @@ var TorrentsTable = new Class({
if (td.getChildren('div').length) {
var div = td.getChildren('div')[0];
var newWidth = td.offsetWidth - 5;
if (div.lastWidth !== newWidth) {
div.setWidth(newWidth);
div.lastWidth = newWidth;
if (td.resized) {
td.resized = false;
div.setWidth(ProgressColumnWidth - 5);
}
if (div.getValue() != progressFormated)
div.setValue(progressFormated);
}
else
else {
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
td.adopt(new ProgressBar(progressFormated.toFloat(), {
'width' : td.offsetWidth - 5
'width' : ProgressColumnWidth - 5
}));
td.resized = false;
}
};
this.columns['progress'].onResize = function (columnName) {
var pos = this.getColumnPos(columnName);
var trs = this.tableBody.getElements('tr');
for (var i = 0; i < trs.length; i++)
this.columns[columnName].updateTd(trs[i].getElements('td')[pos], this.rows.get(trs[i].rowId));
ProgressColumnWidth = -1;
for (var i = 0; i < trs.length; i++) {
var td = trs[i].getElements('td')[pos];
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
td.resized = true;
this.columns[columnName].updateTd(td, this.rows.get(trs[i].rowId));
}
}.bind(this);
// num_seeds

Loading…
Cancel
Save