diff --git a/public/userarea/matrici.php b/public/userarea/matrici.php
index a8138935..54837f69 100644
--- a/public/userarea/matrici.php
+++ b/public/userarea/matrici.php
@@ -313,53 +313,29 @@ function diffBadge($v)
vertical-align: middle;
}
+ /* Nome (2), Cliente (3), Linee (5): senza larghezza, si dividono lo spazio restante */
/* Foto */
#tabellaMatrici th:nth-child(1),
#tabellaMatrici td:nth-child(1) {
width: 90px;
- max-width: 90px;
- }
-
- /* Nome */
- #tabellaMatrici th:nth-child(2),
- #tabellaMatrici td:nth-child(2) {
- width: 260px;
- max-width: 260px;
- }
-
- /* Cliente */
- #tabellaMatrici th:nth-child(3),
- #tabellaMatrici td:nth-child(3) {
- width: 220px;
- max-width: 220px;
}
/* Difficoltà */
#tabellaMatrici th:nth-child(4),
#tabellaMatrici td:nth-child(4) {
- width: 130px;
- max-width: 130px;
- }
-
- /* Linee */
- #tabellaMatrici th:nth-child(5),
- #tabellaMatrici td:nth-child(5) {
- width: 220px;
- max-width: 220px;
+ width: 120px;
}
/* Fogli */
#tabellaMatrici th:nth-child(6),
#tabellaMatrici td:nth-child(6) {
- width: 120px;
- max-width: 120px;
+ width: 110px;
}
/* Azioni */
#tabellaMatrici th:nth-child(7),
#tabellaMatrici td:nth-child(7) {
- width: 260px;
- max-width: 260px;
+ width: 270px;
}
#tabellaMatrici td:nth-child(1) img {
@@ -1681,8 +1657,40 @@ function diffBadge($v)
$(document).ready(function() {
+ // ---- filtro difficoltà ----
+ const DIFF_BANDS = = json_encode(DIFF_BANDS, JSON_UNESCAPED_UNICODE) ?>;
+ const $diffFilter = $('')
+ .append('');
+ Object.keys(DIFF_BANDS).forEach(k => $diffFilter.append($('');
+
+ // chiamata da initComplete: la lingua italiana si carica in modo asincrono,
+ // quindi il box "Cerca" esiste solo a inizializzazione finita
+ function initDiffFilter() {
+ if (!$diffFilter.parent().length) $('#tabellaMatrici_filter').append($diffFilter);
+ }
+ initDiffFilter();
+
+ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
+ if (settings.nTable.id !== 'tabellaMatrici') return true;
+ const f = $diffFilter.val();
+ if (!f) return true;
+ const tr = settings.aoData[dataIndex].nTr;
+ const td = tr && tr.querySelector('td.diff-cell');
+ if (!td) return false;
+ const n = parseInt(td.getAttribute('data-diff') || '0', 10);
+ if (f === 'none') return !n;
+ const b = DIFF_BANDS[f];
+ return n >= b.min && n <= b.max;
+ });
+ $diffFilter.on('change', () => $('#tabellaMatrici').DataTable().draw());
+
$('#tabellaMatrici').DataTable({
order: [],
+ autoWidth: false, // le larghezze le decide il CSS (altrimenti la colonna Azioni esce dallo schermo)
+ initComplete: function() {
+ initDiffFilter();
+ },
columnDefs: [{
targets: 0,
orderable: false,
@@ -1712,27 +1720,6 @@ function diffBadge($v)
.attr('placeholder', 'Nome matrice, cliente…')
.addClass('form-control');
- // ---- filtro difficoltà ----
- const DIFF_BANDS = = json_encode(DIFF_BANDS, JSON_UNESCAPED_UNICODE) ?>;
- const $diffFilter = $('')
- .append('');
- Object.keys(DIFF_BANDS).forEach(k => $diffFilter.append($('');
- $('#tabellaMatrici_filter').append($diffFilter);
-
- $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
- if (settings.nTable.id !== 'tabellaMatrici') return true;
- const f = $diffFilter.val();
- if (!f) return true;
- const tr = settings.aoData[dataIndex].nTr;
- const td = tr && tr.querySelector('td.diff-cell');
- if (!td) return false;
- const n = parseInt(td.getAttribute('data-diff') || '0', 10);
- if (f === 'none') return !n;
- const b = DIFF_BANDS[f];
- return n >= b.min && n <= b.max;
- });
- $diffFilter.on('change', () => $('#tabellaMatrici').DataTable().draw());
function resetFotoMatrice(photoUrl) {
$("#fotoMatrice").val('');