Ensure column order and width prefs are properly retained

This commit is contained in:
Adomas Venčkauskas 2021-04-21 14:02:42 +03:00 committed by Dan Stillman
parent 9e04250142
commit ff627b7d3f

View file

@ -1229,9 +1229,11 @@ var Columns = class {
} }
_getColumnPrefsToPersist(column) { _getColumnPrefsToPersist(column) {
if (!column.zoteroPersist) return {}; let persistKeys = column.zoteroPersist;
if (!persistKeys) persistKeys = new Set();
// Always persist
['ordinal', 'hidden', 'sortDirection'].forEach(k => persistKeys.add(k));
let persistSettings = {}; let persistSettings = {};
const persistKeys = column.zoteroPersist;
for (const key in column) { for (const key in column) {
if (persistKeys.has(key) || key == 'dataKey') { if (persistKeys.has(key) || key == 'dataKey') {
persistSettings[key] = column[key]; persistSettings[key] = column[key];
@ -1270,7 +1272,7 @@ var Columns = class {
} }
const column = this._columns.find(column => column.dataKey == dataKey); const column = this._columns.find(column => column.dataKey == dataKey);
const styleIndex = this._columnStyleMap[dataKey]; const styleIndex = this._columnStyleMap[dataKey];
if (storePrefs) { if (storePrefs && (!column.fixedWidth || (column.zoteroPersist && !column.zoteroPersist.has('width')))) {
prefs[dataKey] = prefs[dataKey] || {}; prefs[dataKey] = prefs[dataKey] || {};
prefs[dataKey].width = width; prefs[dataKey].width = width;
} }