1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-04 09:47:34 +01:00

Fix temporanea per forzare il ricaricamento di datatables alla ricerca

This commit is contained in:
loviuz 2023-02-06 16:27:36 +01:00
parent e64bcb8eef
commit bbd1d1cad7

View File

@ -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;
}
$('<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 fa-2x' + (value ? '' : ' hide') + '"></i>')
.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'<input>
$("thead input, .search").on('keypress', function (e) {
stopTableSorting(e);
@ -549,3 +558,7 @@ function getTable(selector) {
},
};
}
$.expr[':'].emptyVal = function(obj){
return obj.value === '';
};