Bugzilla – Attachment 159238 Details for
Bug 35396
Replace Datatables' column filters throttling with input timeout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35396 - Replace Datatables' column filters throttling with input timeout
0001-Bug-35396-Replace-Datatables-column-filters-throttli.patch (text/plain), 2.29 KB, created by
Lari Strand
on 2023-11-24 12:39:20 UTC
(
hide
)
Description:
Bug 35396 - Replace Datatables' column filters throttling with input timeout
Filename:
MIME Type:
Creator:
Lari Strand
Created:
2023-11-24 12:39:20 UTC
Size:
2.29 KB
patch
obsolete
>From 202447a98eb655cf73ffa20263fb3e2e924551c0 Mon Sep 17 00:00:00 2001 >From: lmstrand <lmstrand@gmail.com> >Date: Fri, 24 Nov 2023 14:08:21 +0200 >Subject: [PATCH] Bug 35396 - Replace Datatables' column filters throttling > with input timeout > >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 31 ++++++++++++------- > 1 file changed, 19 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 564edbba4b..c8b916535b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -911,17 +911,24 @@ 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(); >- }, 500); >- >- $( input_type, this ).on( 'keyup change', function () { >- if ( table_dt.column(i).search() !== this.value ) { >- if ( input_type == "input" ) { >- search(i, this.value) >+ function delay(callback, ms) { >+ var timer = 0; >+ return function () { >+ var context = this, args = arguments; >+ clearTimeout(timer); >+ timer = setTimeout(function () { >+ callback.apply(context, args); >+ }, ms || 0); >+ }; >+ } >+ >+ $(input_type, this).on('keyup change', (delay(function () { >+ if (table_dt.column(i).search() !== this.value) { >+ if (input_type == "input") { >+ table_dt >+ .column(i) >+ .search(this.value) >+ .draw(); > } else { > table_dt > .column(i) >@@ -929,7 +936,7 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > .draw(); > } > } >- } ); >+ }, 500))); > } else { > $(this).html(''); > } >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35396
:
159238
|
159242
|
161325