Browse Source

Reselect torrents in WebUI after full update

Temp fix for #8209.
adaptive-webui-19844
Thomas Piccirello 7 years ago
parent
commit
2227c3afc1
  1. 6
      src/webui/www/private/scripts/client.js
  2. 9
      src/webui/www/private/scripts/dynamicTable.js

6
src/webui/www/private/scripts/client.js

@ -289,9 +289,11 @@ window.addEvent('load', function () { @@ -289,9 +289,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 = {};
}
@ -348,6 +350,10 @@ window.addEvent('load', function () { @@ -348,6 +350,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);

9
src/webui/www/private/scripts/dynamicTable.js

@ -500,6 +500,15 @@ var DynamicTable = new Class({ @@ -500,6 +500,15 @@ var DynamicTable = new Class({
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…
Cancel
Save