mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 19:57:45 +03:00
Merge pull request #6447 from buinsky/master
WebUI: Improve performance of updating 'progress' column
This commit is contained in:
commit
922fec44d2
1 changed files with 18 additions and 8 deletions
|
@ -32,6 +32,7 @@
|
|||
**************************************************************/
|
||||
|
||||
var DynamicTableHeaderContextMenuClass = null;
|
||||
var ProgressColumnWidth = -1;
|
||||
|
||||
var DynamicTable = 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…
Reference in a new issue