mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Merge pull request #8218 from Piccirello/webui-selection-bug
Reselect webui torrents after full_update. Temporary fix for #8209.
This commit is contained in:
commit
6f7f7d87c6
2 changed files with 20 additions and 10 deletions
|
@ -298,9 +298,11 @@ window.addEvent('load', function () {
|
|||
onSuccess : function (response) {
|
||||
$('error_div').set('html', '');
|
||||
if (response) {
|
||||
var torrentsTableSelectedRows;
|
||||
var update_categories = false;
|
||||
var full_update = (response['full_update'] === true);
|
||||
if (full_update) {
|
||||
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
|
||||
torrentsTable.clear();
|
||||
category_list = {};
|
||||
}
|
||||
|
@ -357,6 +359,10 @@ window.addEvent('load', function () {
|
|||
updateCategoryList();
|
||||
torrentsTableContextMenu.updateCategoriesSubMenu(category_list);
|
||||
}
|
||||
|
||||
if (full_update)
|
||||
// re-select previously selected rows
|
||||
torrentsTable.reselectRows(torrentsTableSelectedRows);
|
||||
}
|
||||
clearTimeout(syncMainDataTimer);
|
||||
syncMainDataTimer = syncMainData.delay(syncMainDataTimerPeriod);
|
||||
|
|
|
@ -489,22 +489,26 @@ var DynamicTable = new Class({
|
|||
},
|
||||
|
||||
selectRow : function (rowId) {
|
||||
this.selectedRows.empty();
|
||||
this.deselectAll();
|
||||
this.selectedRows.push(rowId);
|
||||
var trs = this.tableBody.getElements('tr');
|
||||
for (var i = 0; i < trs.length; i++) {
|
||||
var tr = trs[i];
|
||||
if (tr.rowId == rowId) {
|
||||
if (!tr.hasClass('selected'))
|
||||
tr.addClass('selected');
|
||||
}
|
||||
this.tableBody.getElements('tr').each(function(tr) {
|
||||
if (tr.rowId == rowId)
|
||||
tr.addClass('selected');
|
||||
else
|
||||
if (tr.hasClass('selected'))
|
||||
tr.removeClass('selected');
|
||||
}
|
||||
});
|
||||
this.onSelectedRowChanged();
|
||||
},
|
||||
|
||||
reselectRows : function(rowIds) {
|
||||
this.deselectAll();
|
||||
this.selectedRows = rowIds.slice();
|
||||
this.tableBody.getElements('tr').each(function(tr) {
|
||||
if (rowIds.indexOf(tr.rowId) > -1)
|
||||
tr.addClass('selected');
|
||||
});
|
||||
},
|
||||
|
||||
onSelectedRowChanged : function () {},
|
||||
|
||||
updateRowData : function (data) {
|
||||
|
|
Loading…
Reference in a new issue