Skip to content

Commit 0743032

Browse files
committed
fix table headers on table resize #3833
1 parent 2c839cb commit 0743032

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/resources/views/base/inc/sidebar.blade.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@
4949
document.querySelectorAll('.sidebar-toggler').forEach(function(toggler) {
5050
toggler.addEventListener('click', function() {
5151
sessionStorage.setItem('sidebar-collapsed', Number(!document.body.classList.contains(sidebarClass)))
52+
// wait for the sidebar animation to end (250ms) and then update the table headers because datatables uses a cached version
53+
// and dont update this values if there are dom changes after the table is draw. The sidebar toggling makes
54+
// the table change width, so the headers need to be adjusted accordingly.
55+
setTimeout(function() {
56+
if(typeof crud !== "undefined" && crud.table) {
57+
crud.table.fixedHeader.adjust();
58+
}
59+
}, 300);
5260
})
5361
});
5462
// Set active state on menu element

0 commit comments

Comments
 (0)