View | Details | Raw Unified | Return to bug 35284
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-6 / +10 lines)
Lines 63-69 var dataTablesDefaults = { Link Here
63
        });
63
        });
64
64
65
        if (settings.ajax) {
65
        if (settings.ajax) {
66
            _dt_add_delay($("#"+tableId));
66
            let table_node = $("#" + tableId);
67
            if ( typeof this.api === 'function' ) {
68
                _dt_add_delay(this.api(), table_node);
69
            } else {
70
                let dt = $(table_node).DataTable();
71
                _dt_add_delay(dt, table_node);
72
            }
67
        }
73
        }
68
    }
74
    }
69
};
75
};
Lines 930-938 function _dt_add_filters(table_node, table_dt, filters_options = {}) { Link Here
930
// These keys must not launch filtering
936
// These keys must not launch filtering
931
var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40);
937
var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40);
932
938
933
function _dt_add_delay(table_node, delay_ms) {
939
function _dt_add_delay(table_dt, table_node, delay_ms) {
934
940
935
    let dt = table_node.DataTable();
936
    delay = (typeof delay == 'undefined') ? 500 : delay;
941
    delay = (typeof delay == 'undefined') ? 500 : delay;
937
942
938
    var previousSearch = null;
943
    var previousSearch = null;
Lines 944-957 function _dt_add_delay(table_node, delay_ms) { Link Here
944
        if (blacklist_keys.indexOf(event.keyCode) != -1) {
949
        if (blacklist_keys.indexOf(event.keyCode) != -1) {
945
            return;
950
            return;
946
        } else if ( event.keyCode == '13' ) {
951
        } else if ( event.keyCode == '13' ) {
947
            dt.search($(input).val()).draw();
952
            table_dt.search($(input).val()).draw();
948
        } else {
953
        } else {
949
            let val = $(input).val();
954
            let val = $(input).val();
950
            if (previousSearch === null || previousSearch != val){
955
            if (previousSearch === null || previousSearch != val){
951
                window.clearTimeout(timerId);
956
                window.clearTimeout(timerId);
952
                previousSearch = val;
957
                previousSearch = val;
953
                timerId = window.setTimeout(function(){
958
                timerId = window.setTimeout(function(){
954
                    dt.search($(input).val()).draw();
959
                    table_dt.search($(input).val()).draw();
955
                }, delay);
960
                }, delay);
956
            }
961
            }
957
        }
962
        }
958
- 

Return to bug 35284