Skip to content

Commit 6a49e49

Browse files
committed
build(deps): ripristino librerie datatables compatibili
1 parent a7cce93 commit 6a49e49

5 files changed

Lines changed: 37 additions & 33 deletions

File tree

assets/src/css/datatables.css

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ table.dataTable thead th.sorting:after,
3636
table.dataTable thead th.sorting_asc:after,
3737
table.dataTable thead th.sorting_desc:after {
3838
position: absolute;
39-
top: 12px;
39+
top: 20px;
4040
right: 8px;
4141
display: block;
4242
font-family: FontAwesome;
@@ -64,15 +64,6 @@ div.dataTables_scrollBody table.dataTable thead th.sorting_desc:after {
6464
}
6565

6666

67-
/* In Bootstrap and Foundation the padding top is a little different from the DataTables stylesheet */
68-
69-
table.table thead th.sorting:after,
70-
table.table thead th.sorting_asc:after,
71-
table.table thead th.sorting_desc:after {
72-
top: 8px;
73-
}
74-
75-
7667
/*
7768
* DataTables style pagination controls
7869
*/

assets/src/js/base/datatables-buttons.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,30 @@ $(document).ready(function () {
5353
var wrapper = getTable(table_selector);
5454
var table = wrapper.datatable;
5555

56-
// Selezione di tutte le righe della tabella corrente senza caricamento
57-
var row_ids = table.rows().ids().toArray();
58-
wrapper.addSelectedRows(row_ids);
59-
table.clear().draw();
56+
// Visualizzazione del caricamento
57+
$("#main_loading").show();
58+
59+
// Parametri della richiesta
60+
var params = table.ajax.params();
61+
params.length = -1;
62+
63+
$.ajax({
64+
url: table.ajax.url(),
65+
data: params,
66+
type: 'GET',
67+
dataType: "json",
68+
success: function (response) {
69+
var row_ids = response.data.map(function (a) {
70+
return a.id;
71+
});
72+
73+
// Chiamata di selezione completa
74+
wrapper.addSelectedRows(row_ids);
75+
table.clear().draw();
76+
77+
$("#main_loading").hide();
78+
}
79+
})
6080
});
6181

6282
$(".btn-select-none").click(function () {

assets/src/js/functions/datatables.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function start_datatables( $elements ) {
6262
const single_value = search[(id_plugin ? id_plugin : "") + "_search_" + id] ? search[(id_plugin ? id_plugin : "") + "_search_" + id] : "";
6363

6464
column_search.push({
65-
"search": single_value,
65+
"sSearch": single_value,
6666
});
6767
});
6868

@@ -78,8 +78,8 @@ function start_datatables( $elements ) {
7878
deferRender: true,
7979
ordering: true,
8080
searching: true,
81-
order: [],
82-
searchCols: column_search,
81+
aaSorting: [],
82+
aoSearchCols: column_search,
8383
scrollY: "60vh",
8484
scrollX: '100%',
8585
retrieve: true,
@@ -287,20 +287,13 @@ function initComplete(settings) {
287287
const $this = $(this);
288288
const search = getTableSearch();
289289

290-
// In DataTables 2.x, il selettore .search potrebbe non funzionare come previsto
291-
// Usiamo un approccio più robusto basato sugli ID delle colonne
292-
api.columns().every(function () {
290+
api.columns('.search').every(function () {
293291
const column = this;
294-
const header = $(column.header());
295-
296-
// Verifica se la colonna ha la classe 'search'
297-
if (!header.hasClass('search')) {
298-
return;
299-
}
300292

301293
// Valore predefinito della ricerca
302294
let tempo;
303295
const id_plugin = $this.data('idplugin');
296+
const header = $(column.header());
304297
const name = header.attr('id').replace('th_', '');
305298

306299
const value = search[(id_plugin ? id_plugin : "") + "_search_" + name] ? search[(id_plugin ? id_plugin : "") + "_search_" + name] : '';

gulpfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ const JS = gulp.parallel(function vendorJS() {
112112
'moment/moment.js',
113113
'components-jqueryui/jquery-ui.js',
114114
'datatables.net/js/jquery.dataTables.js',
115-
'datatables.net-buttons-bs/node_modules/datatables.net-buttons/js/dataTables.buttons.js',
116-
'datatables.net-buttons-bs/node_modules/datatables.net-buttons/js/buttons.colVis.js',
117-
'datatables.net-buttons-bs/node_modules/datatables.net-buttons/js/buttons.flash.js',
118-
'datatables.net-buttons-bs/node_modules/datatables.net-buttons/js/buttons.html5.js',
119-
'datatables.net-buttons-bs/node_modules/datatables.net-buttons/js/buttons.print.js',
115+
'datatables.net-buttons/js/dataTables.buttons.js',
116+
'datatables.net-buttons/js/buttons.colVis.js',
117+
'datatables.net-buttons/js/buttons.flash.js',
118+
'datatables.net-buttons/js/buttons.html5.js',
119+
'datatables.net-buttons/js/buttons.print.js',
120120
'datatables.net-scroller/js/dataTables.scroller.js',
121121
'datatables.net-select/js/dataTables.select.js',
122122
'dropzone/dist/dropzone.js',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"ckeditor4": "ckeditor/ckeditor4-releases#full/4.22.1",
2020
"clipper-lib": "^6.4.2",
2121
"components-jqueryui": "^1.12.1",
22-
"datatables.net-bs": "^2.3.6",
22+
"datatables.net-bs": "^1.10.15",
2323
"datatables.net-buttons-bs": "^1.3.1",
2424
"datatables.net-scroller-bs": "^2.4.3",
25-
"datatables.net-select-bs": "^3.1.3",
25+
"datatables.net-select-bs": "^1.2.2",
2626
"dropzone": "^5.7.2",
2727
"eonasdan-bootstrap-datetimepicker": "^4.17.49",
2828
"font-awesome": "^4.7.0",

0 commit comments

Comments
 (0)