Bugzilla – Attachment 174268 Details for
Bug 38391
DT's add filters called too many times
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38391: Redraw the filters row on table redraw
Bug-38391-Redraw-the-filters-row-on-table-redraw.patch (text/plain), 2.79 KB, created by
Martin Renvoize (ashimema)
on 2024-11-08 10:30:35 UTC
(
hide
)
Description:
Bug 38391: Redraw the filters row on table redraw
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-11-08 10:30:35 UTC
Size:
2.79 KB
patch
obsolete
>From 09e855e2e1b9df0d36df3a342e8bc5c06b6a3f81 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 7 Nov 2024 14:16:44 +0100 >Subject: [PATCH] Bug 38391: Redraw the filters row on table redraw > >We used to adjust the filters row when the column visibility changed. >It was working, but at the initialization of the table this event if >fired once per columns. On the items table it means 36x. >When a filtering/sorting, the draw event is triggered once, but the >column-visibility.dt is called 36x > >Test plan: >Try with and without this patch and compare the delay between the query >is received and the page is redrawn. > >You can test with 1000 libraries on the items table. >"Show filters" then filters using the global search. >On Firefox you will notice that the response is received but the table >not redrawn directly. >With this patch it should be redrawn pretty fase. > >Another test would be to add the following 2 lines: >+ let i = 0; > table_dt.on("draw", function(){ >+ console.log("redraw filters %s".format(i)); > if ( add_filters ) { > _dt_add_filters(this, table_dt, filters_options); > } > >Open the console and notice that "redraw filters" is logged only once. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 2 +- > koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 1a0a893c5ab..82c3cd4fbee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -1143,7 +1143,7 @@ function _dt_save_restore_state(table_settings, external_filter_nodes={}){ > _dt_add_filters(this, table_dt, filters_options); > } > >- table_dt.on("column-visibility.dt", function(){ >+ table_dt.on("draw", function(){ > if ( add_filters ) { > _dt_add_filters(this, table_dt, filters_options); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >index d56b9563c85..1e9f33c89be 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -224,7 +224,7 @@ export default { > _dt_add_filters(table_node, dt, filters_options) > } > >- dt.on("column-visibility.dt", function () { >+ dt.on("draw", function () { > if (add_filters) { > _dt_add_filters(table_node, dt, filters_options) > } >-- >2.47.0
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 38391
:
174193
|
174235
|
174253
|
174268
|
174476
|
174596
|
174683
|
174718