Skip to content

Commit 2bb0160

Browse files
committed
fix: riduzione doppio caricamento datatables con filtri non via GET
1 parent a521883 commit 2bb0160

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

assets/src/js/functions/datatables.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ function initComplete(settings) {
291291

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

294-
if (value !== '') {
295-
forceSearch = true;
296-
}
297-
298294
$('<br><input type="text" style="width:100%" class="form-control' + (value ? ' input-searching' : '') + '" placeholder="' + globals.translations.filter + '..." value="' + value.replace(/"/g, '&quot;') + '"><i class="deleteicon fa fa-times ' + (value ? '' : ' hide') + '"></i>')
299295
.appendTo(column.header())
300296
.on('keyup', function (e) {
@@ -342,7 +338,8 @@ function initComplete(settings) {
342338
});
343339
});
344340

345-
if (forceSearch) {
341+
// Fai il trigger di table se via GET è presente un parametro che inizia con search_
342+
if (window.location.search.indexOf('search_') > -1) {
346343
$('table.main-records:visible .search > input:not(:emptyVal)').first().trigger('keyup');
347344
}
348345

0 commit comments

Comments
 (0)