fix column matrici
This commit is contained in:
parent
3043522465
commit
8732f21af8
@ -138,6 +138,65 @@
|
||||
.dataTables_wrapper .dataTables_filter input {
|
||||
padding-right: 42px !important;
|
||||
}
|
||||
|
||||
/* --- FIX larghezze tabella matrici --- */
|
||||
#tabellaMatrici {
|
||||
table-layout: fixed;
|
||||
/* rende fisse le larghezze */
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#tabellaMatrici th,
|
||||
#tabellaMatrici td {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
/* evita che il testo allarghi */
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Foto: più stretta */
|
||||
#tabellaMatrici th:nth-child(1),
|
||||
#tabellaMatrici td:nth-child(1) {
|
||||
width: 90px;
|
||||
max-width: 90px;
|
||||
}
|
||||
|
||||
/* Nome: più largo */
|
||||
#tabellaMatrici th:nth-child(2),
|
||||
#tabellaMatrici td:nth-child(2) {
|
||||
width: 320px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
/* Cliente: più largo */
|
||||
#tabellaMatrici th:nth-child(3),
|
||||
#tabellaMatrici td:nth-child(3) {
|
||||
width: 320px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
/* Data: piccola */
|
||||
#tabellaMatrici th:nth-child(4),
|
||||
#tabellaMatrici td:nth-child(4) {
|
||||
width: 120px;
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
/* Azioni: fissa */
|
||||
#tabellaMatrici th:nth-child(5),
|
||||
#tabellaMatrici td:nth-child(5) {
|
||||
width: 170px;
|
||||
max-width: 170px;
|
||||
}
|
||||
|
||||
/* Immagine: non “sfora” mai nella cella */
|
||||
#tabellaMatrici td:nth-child(1) img {
|
||||
width: 70px;
|
||||
/* puoi scendere a 60 */
|
||||
height: 60px;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
@ -213,19 +272,33 @@
|
||||
echo "<tr>";
|
||||
|
||||
// colonna FOTO
|
||||
echo "<td>
|
||||
<img src='" . htmlspecialchars($thumb, ENT_QUOTES) . "'
|
||||
// colonna FOTO (robusta: NP appare solo se l'immagine non si carica)
|
||||
$imgSrc = $hasPhoto ? $thumb : ''; // se non c'è foto, src vuoto → trigger onerror
|
||||
|
||||
echo "<td class='foto-cell'>
|
||||
<img src='" . htmlspecialchars($imgSrc, ENT_QUOTES) . "'
|
||||
class='thumb-img'
|
||||
data-full='" . htmlspecialchars($thumb, ENT_QUOTES) . "'
|
||||
style='height:60px; cursor:pointer; border-radius:6px; opacity:" . ($hasPhoto ? "1" : "0.6") . ";'
|
||||
title='" . ($hasPhoto ? "Clicca per ingrandire" : "") . "'>
|
||||
style='height:60px; cursor:pointer; border-radius:6px; " . ($hasPhoto ? "" : "display:none;") . "'
|
||||
title='" . ($hasPhoto ? "Clicca per ingrandire" : "") . "'
|
||||
onerror=\"
|
||||
this.style.display='none';
|
||||
this.closest('td').querySelector('.no-photo').style.display='inline-block';
|
||||
\">
|
||||
<span class='no-photo text-muted fw-semibold' style='display:" . ($hasPhoto ? "none" : "inline-block") . ";'>NP</span>
|
||||
</td>";
|
||||
|
||||
// colonna NOME
|
||||
echo "<td>" . htmlspecialchars($row['nome']) . "</td>";
|
||||
|
||||
// colonna CLIENTE
|
||||
echo "<td>" . htmlspecialchars($row['cliente']) . "</td>";
|
||||
// colonna NOME (con tooltip)
|
||||
echo "<td title='" . htmlspecialchars($row['nome'], ENT_QUOTES) . "'>"
|
||||
. htmlspecialchars($row['nome'])
|
||||
. "</td>";
|
||||
|
||||
// colonna CLIENTE (con tooltip)
|
||||
echo "<td title='" . htmlspecialchars($row['cliente'], ENT_QUOTES) . "'>"
|
||||
. htmlspecialchars($row['cliente'])
|
||||
. "</td>";
|
||||
|
||||
|
||||
// colonna DATA
|
||||
echo "<td>{$dataIT}</td>";
|
||||
@ -327,6 +400,14 @@
|
||||
order: [
|
||||
[0, 'desc']
|
||||
],
|
||||
columnDefs: [{
|
||||
targets: 0, // colonna FOTO
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
render: function(data, type, row, meta) {
|
||||
return data; // lascia l'HTML così com'è (img + NP)
|
||||
}
|
||||
}],
|
||||
pageLength: 50,
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/it-IT.json'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user