Bug 35284: Add throttling to column filters

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-11-09 08:58:41 +01:00 committed by Tomas Cohen Arazi
parent 8738dcd988
commit 5220dd6004
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -911,13 +911,17 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) {
}
}
var search = $.fn.dataTable.util.throttle( function ( i, val ) {
table_dt
.column( i )
.search( val )
.draw();
}, 1000 );
$( input_type, this ).on( 'keyup change', function () {
if ( table_dt.column(i).search() !== this.value ) {
if ( input_type == "input" ) {
table_dt
.column(i)
.search( this.value )
.draw();
search(i, this.value)
} else {
table_dt
.column(i)