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>
This commit is contained in:
Jonathan Druart 2023-11-09 08:58:41 +01:00 committed by Pedro Amorim
parent a52508d266
commit 9e93b94a72

View file

@ -906,13 +906,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)