Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ table {

.table-bordered th,
.table-bordered td {
border: 1px solid light-dark(#ddd, #444) !important;
}
border: 1px solid light-dark(#ddd, #444) !important;
}

table.sortable {
border-left: 0;
Expand Down Expand Up @@ -169,6 +169,11 @@ th {
vertical-align: bottom;
}

/* scroll DataTables horizontally without splitting header and body into separate tables */
.dt-layout-table > div {
overflow-x: auto;
}

td.firstcell {
border-left: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
*/

var dataTableRefs = new Map();
var dataTableColKeys = new Map();

/**
* This function returns the entire response from session storage
Expand Down Expand Up @@ -150,9 +151,16 @@ function getDataTableCols(storageKey) {
* and executes an ajax method to load the data.
*/
function refreshTable(table, storageKey) {
var dataTableRef = dataTableRefs.get(table);
var colsKey = JSON.stringify(getStoredColumns(storageKey));

// If column data has not changed, only reload the rows so scroll position and column state do not reset
if (dataTableRef != null && dataTableColKeys.get(table) === colsKey) {
ajaxReloadTable(dataTableRef);
return;
}

// Destroy the DataTable
var dataTableRef = dataTableRefs.get(table);
if (dataTableRef != null) {
dataTableRef.destroy();
}
Expand Down Expand Up @@ -182,6 +190,7 @@ function refreshTable(table, storageKey) {
dataTableRef = createDataTable(table, storageKey);
ajaxReloadTable(dataTableRef);
dataTableRefs.set(table, dataTableRef);
dataTableColKeys.set(table, colsKey);
}

/**
Expand Down Expand Up @@ -253,9 +262,24 @@ function createDataTable(table, storageKey) {
});
},
"buttons": [{
"extend": 'colvis',
"text": '<i class="bi bi-gear"></i>',
"titleAttr": 'Columns'
"extend": 'colvis',
"text": '<i class="bi bi-gear"></i>',
"titleAttr": 'Columns',
},
{
"extend": 'spacer'
},
{
"text": 'Reset',
"titleAttr": 'Reset column selection and column order',
action: function (e, table) {
// reset column selection
table.columns().visible(true);
// reset column order
if (table.colReorder) {
table.colReorder.reset();
}
}
}],
"layout": {
"topStart": "pageLength",
Expand Down
Loading