diff --git a/include/top.php b/include/top.php index ffd4620e8..b73543feb 100644 --- a/include/top.php +++ b/include/top.php @@ -131,6 +131,8 @@ if (Auth::check()) { ckeditorToolbar: [ ["Undo","Redo","-","Cut","Copy","Paste","PasteText","PasteFromWord","-","Scayt", "-","Link","Unlink","-","Bold","Italic","Underline","Superscript","SpecialChar","HorizontalRule","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Styles","Format","Image","Table", "TextColor", "BGColor" ], ], + + tempo_attesa_ricerche: '.get_var('Tempo di attesa ricerche in secondi').', }; '; } diff --git a/lib/functions.js b/lib/functions.js index cf915a62e..65ea78715 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -534,6 +534,9 @@ function start_datatables() { }); var sum; + var tempo; + var tempo_attesa_ricerche = (globals.tempo_attesa_ricerche*1000); + var table = $this.DataTable({ language: { url: globals.js + '/i18n/datatables/' + globals.locale + '.min.json' @@ -626,6 +629,9 @@ function start_datatables() { $('
') .appendTo(column.header()) .on('keyup', function (e) { + + clearInterval(tempo); + if (e.which != 9) { if (!$(this).val()) { if ($(this).parent().data("slow") != undefined) $("#slow").remove(); @@ -642,13 +648,25 @@ function start_datatables() { idx1 = 'module_' + $this.data('idmodule'); //+ "-" + $this.data('idplugin'); idx2 = 'search_' + $(this).parent().attr('id').replace('th_', ''); + + function start_search(search_value){ + session_set(idx1 + ',' + idx2, search_value, 0); + column.search(search_value).draw(); + } - // Imposto delle sessioni per le ricerche del modulo e del campo specificatsi - session_set(idx1 + ',' + idx2, $(this).val(), 0); - - column.search(this.value).draw(); + // Imposto delle sessioni per le ricerche del modulo e del campo specificatsi + if(e.keyCode == 13 || $(this).val()==''){ + start_search($(this).val()); + }else{ + tempo = window.setTimeout(start_search, tempo_attesa_ricerche, $(this).val()); + } }); }); + + // Disabilito l'ordinamento alla pressione del tasto invio sull' + $("thead input, .search").on('keypress', function (e) { + stopTableSorting(e); + }); // Disabilito l'ordinamento al click sull' $("thead input, .deleteicon").click(function (e) { diff --git a/update/2_4_1.sql b/update/2_4_1.sql index cfa5b11f9..0a1c84339 100644 --- a/update/2_4_1.sql +++ b/update/2_4_1.sql @@ -298,3 +298,6 @@ ADD FOREIGN KEY (`id_module`) REFERENCES `zz_modules`(`id`) ON DELETE CASCADE; -- Widget per attività senza nessun tecnico assegnato INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `order`, `help`) VALUES (NULL, 'Attività da pianificare', 'stats', (SELECT id FROM zz_modules WHERE name = 'Dashboard'), 'controller_top', 'col-md-3', 'SELECT COUNT(id) AS dato FROM in_interventi WHERE id NOT IN (SELECT idintervento FROM in_interventi_tecnici) AND idstatointervento IN (SELECT idstatointervento FROM in_statiintervento WHERE completato = 0) ', '#6dab3c', 'fa fa-cogs', '', './modules/interventi/widgets/interventi.pianificazionedashboard.interventi.php', 'popup', '', 'Promemoria attività da pianificare', 1, '0', NULL); + +-- Impostazione "Tempo di attesa ricerche" +INSERT INTO `zz_settings` (`idimpostazione`, `nome`, `valore`, `tipo`, `editable`, `sezione`) VALUES (NULL, 'Tempo di attesa ricerche in secondi', '2', 'integer', '0', 'Generali');