gtludwig gtludwig - 5 months ago 59
CSS Question

css + thymeleaf - How to auto-adjust displayed screen size?

In my application, I have a default fragment that builds all others. It is transcribed bellow:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">

<head th:include="fragments/common :: commonFragment">
<meta charset="UTF-8" />
<link rel="shortcut-icon" th:href="@{/assets/img/favicon.png}" type="image/x-icon" />
<title th:text="#{app.name}"> </title>
<style> #sidebar-and-content { display: flex; height: 100vh; width: 100%; } .page-body { display: -webkit-flex; display: flex; height: 100vh; width: 100%; overflow: auto; } </style></head>
<body>
<div th:id="defaultFragment" th:fragment="defaultFragment">
<div id="header" th:replace="fragments/header :: headerFragment"> </div>
<div class="main-container container-fluid">
<div id="sidebar-and-content" class="page-container">
<div id="sidebar" th:replace="fragments/sidebar :: sidebarFragment"></div>
<div id="content" class="page-content">
<div class="page-body">
<section layout:fragment="content"></section>
</div>
</div>
</div>
<div th:replace="fragments/footer :: footerFragment"></div>
</div>
</div>
</body>
</html>


All the application pages are built like this:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="fragments/default">

<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

</head>
<body>
<div layout:fragment="content">
<div class="container">
<script type="text/javascript">
</script>
</div>
</div>
</body>
</html>


Say on the I have a table with many rows, on my 1920x1080 laptop screen, most of the time it is built correctly, but on 1366x768 screens it gets build like the first image bellow:

enter image description here

There's a button that collapses the sidebar menu. Ideally I'd like the now bigger screen to resize the table. Instead (again on 1366x768 screen) I get the following:

enter image description here

know this is likely a CSS matter, but how can I fix it?

Answer

Actually, it was a "problem" in the datatable javascript. After some reading on the site, I found out there's the responsive extension. Once I got it figured out, it worked as a charm.

Comments