mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-25 00:03:27 +08:00
Merge pull request #5823 from artoscinote/ma_SCI_8733
Preserve column widths when showing/hiding columns [SCI-8733]
This commit is contained in:
commit
a88e66e12b
1 changed files with 12 additions and 3 deletions
|
@ -503,7 +503,7 @@ var RepositoryDatatable = (function(global) {
|
|||
|
||||
TABLE.ColSizes = state.ColSizes;
|
||||
|
||||
restoreColumnSizes();
|
||||
setTimeout(restoreColumnSizes, 100);
|
||||
}
|
||||
|
||||
function dataTableInit() {
|
||||
|
@ -547,6 +547,15 @@ var RepositoryDatatable = (function(global) {
|
|||
|
||||
// force width of checkbox column
|
||||
data[0] = 30;
|
||||
|
||||
// perserve widths of invisible columns or enforce min width
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i] === 0) {
|
||||
let minWidth = parseInt($(TABLE.column(i).header()).css('min-width'), 10);
|
||||
data[i] = colSizeMap[i] || minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
state.ColSizes = data;
|
||||
|
||||
$(TABLE_WRAPPER_ID).find('.table').addClass('table--resizable-columns');
|
||||
|
@ -744,8 +753,8 @@ var RepositoryDatatable = (function(global) {
|
|||
}
|
||||
});
|
||||
},
|
||||
stateSaveCallback: function(settings, data) {
|
||||
if (Object.keys(colSizeMap).length === 0) return;
|
||||
stateSaveCallback: function(_, data) {
|
||||
if (Object.keys(colSizeMap).length === 0) return true;
|
||||
|
||||
let colSizes = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue