diff --git a/assets/src/js/functions/datatables.js b/assets/src/js/functions/datatables.js
index 8544c346f..4235e7770 100755
--- a/assets/src/js/functions/datatables.js
+++ b/assets/src/js/functions/datatables.js
@@ -275,6 +275,7 @@ function initComplete(settings) {
const api = this.api();
const $this = $(this);
const search = getTableSearch();
+ var forceSearch = false;
api.columns('.search').every(function () {
const column = this;
@@ -286,6 +287,10 @@ function initComplete(settings) {
const value = search['search_' + name] ? search['search_' + name] : '';
+ if (value !== '') {
+ forceSearch = true;
+ }
+
$('
')
.appendTo(column.header())
.on('keyup', function (e) {
@@ -333,6 +338,10 @@ function initComplete(settings) {
});
});
+ if (forceSearch) {
+ $('table.main-records:visible .search > input:not(:emptyVal)').first().trigger('keyup');
+ }
+
// Disabilito l'ordinamento alla pressione del tasto invio sull'
$("thead input, .search").on('keypress', function (e) {
stopTableSorting(e);
@@ -549,3 +558,7 @@ function getTable(selector) {
},
};
}
+
+$.expr[':'].emptyVal = function(obj){
+ return obj.value === '';
+};
\ No newline at end of file