mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-09 16:18:43 +01:00
Fix temporanea per forzare il ricaricamento di datatables alla ricerca
This commit is contained in:
parent
e64bcb8eef
commit
bbd1d1cad7
@ -275,6 +275,7 @@ function initComplete(settings) {
|
|||||||
const api = this.api();
|
const api = this.api();
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
const search = getTableSearch();
|
const search = getTableSearch();
|
||||||
|
var forceSearch = false;
|
||||||
|
|
||||||
api.columns('.search').every(function () {
|
api.columns('.search').every(function () {
|
||||||
const column = this;
|
const column = this;
|
||||||
@ -286,6 +287,10 @@ function initComplete(settings) {
|
|||||||
|
|
||||||
const value = search['search_' + name] ? search['search_' + name] : '';
|
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, '"') + '"><i class="deleteicon fa fa-times fa-2x' + (value ? '' : ' hide') + '"></i>')
|
$('<br><input type="text" style="width:100%" class="form-control' + (value ? ' input-searching' : '') + '" placeholder="' + globals.translations.filter + '..." value="' + value.replace(/"/g, '"') + '"><i class="deleteicon fa fa-times fa-2x' + (value ? '' : ' hide') + '"></i>')
|
||||||
.appendTo(column.header())
|
.appendTo(column.header())
|
||||||
.on('keyup', function (e) {
|
.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>
|
// Disabilito l'ordinamento alla pressione del tasto invio sull'<input>
|
||||||
$("thead input, .search").on('keypress', function (e) {
|
$("thead input, .search").on('keypress', function (e) {
|
||||||
stopTableSorting(e);
|
stopTableSorting(e);
|
||||||
@ -549,3 +558,7 @@ function getTable(selector) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.expr[':'].emptyVal = function(obj){
|
||||||
|
return obj.value === '';
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user