Skip to content

Commit a06a39a

Browse files
committed
fix: enable table horizontal scrolling when wide
Wide tables did not trigger a horizontal scrollbar either on the page or the table, therefore cutting off the table. Add some JavaScript and CSS tricks suggested by CursorAI, namely with `scrollX` and accompanying CSS to allow the scrollbar on the DataTable. Application of meaningfy-ws/diff-query-generator#33. Fixes gh-130, DIF1-27
1 parent 11f0c23 commit a06a39a

File tree

3 files changed

+48
-9
lines changed
  • resources/templates
    • owl-core-en-only/template_variants/html/templates
    • shacl-core-en-only/template_variants/html/templates
    • skos-core-en-only/template_variants/html/templates

3 files changed

+48
-9
lines changed

resources/templates/owl-core-en-only/template_variants/html/templates/layout.html

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@
5353
margin-top: 0.5em;
5454
}
5555

56+
/* Enable horizontal scrolling for wide tables */
57+
#print-container {
58+
overflow-x: auto;
59+
}
60+
61+
.dataTables_wrapper {
62+
overflow-x: auto;
63+
}
64+
65+
table.display {
66+
width: 100% !important;
67+
min-width: 100%;
68+
}
69+
5670
@media print {
5771
#toc {
5872
visibility: hidden;
@@ -122,9 +136,8 @@ <h1 class="ui header center aligned reportTitle" id="skip-toc">{{ conf.title }}<
122136
'print'
123137
],
124138
"lengthMenu": [[5, 15, 30, -1], [5, 15, 30, "All"]],
125-
responsive: {
126-
details: true
127-
}
139+
scrollX: true,
140+
autoWidth: false
128141
});
129142
$("h2").each(function () {
130143
if (!$(this).next().is("section") && !$(this).next().is("h3") && !$(this).next().hasClass("dataTables_wrapper")) {

resources/templates/shacl-core-en-only/template_variants/html/templates/layout.html

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@
5353
margin-top: 0.5em;
5454
}
5555

56+
/* Enable horizontal scrolling for wide tables */
57+
#print-container {
58+
overflow-x: auto;
59+
}
60+
61+
.dataTables_wrapper {
62+
overflow-x: auto;
63+
}
64+
65+
table.display {
66+
width: 100% !important;
67+
min-width: 100%;
68+
}
69+
5670
@media print {
5771
#toc {
5872
visibility: hidden;
@@ -122,9 +136,8 @@ <h1 class="ui header center aligned reportTitle" id="skip-toc">{{ conf.title }}<
122136
'print'
123137
],
124138
"lengthMenu": [[5, 15, 30, -1], [5, 15, 30, "All"]],
125-
responsive: {
126-
details: true
127-
}
139+
scrollX: true,
140+
autoWidth: false
128141
});
129142
$("h2").each(function () {
130143
if (!$(this).next().is("section") && !$(this).next().is("h3") && !$(this).next().hasClass("dataTables_wrapper")) {

resources/templates/skos-core-en-only/template_variants/html/templates/layout.html

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@
5353
margin-top: 0.5em;
5454
}
5555

56+
/* Enable horizontal scrolling for wide tables */
57+
#print-container {
58+
overflow-x: auto;
59+
}
60+
61+
.dataTables_wrapper {
62+
overflow-x: auto;
63+
}
64+
65+
table.display {
66+
width: 100% !important;
67+
min-width: 100%;
68+
}
69+
5670
@media print {
5771
#toc {
5872
visibility: hidden;
@@ -122,9 +136,8 @@ <h1 class="ui header center aligned reportTitle" id="skip-toc">{{ conf.title }}<
122136
'print'
123137
],
124138
"lengthMenu": [[5, 15, 30, -1], [5, 15, 30, "All"]],
125-
responsive: {
126-
details: true
127-
}
139+
scrollX: true,
140+
autoWidth: false
128141
});
129142
$("h2").each(function () {
130143
if (!$(this).next().is("section") && !$(this).next().is("h3") && !$(this).next().hasClass("dataTables_wrapper")) {

0 commit comments

Comments
 (0)