Bugzilla – Attachment 174837 Details for
Bug 38485
Update column visibility on holdings table correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38485: Take user's previous change into consideration for holdings tables col vis
Bug-38485-Take-users-previous-change-into-consider.patch (text/plain), 4.25 KB, created by
Jonathan Druart
on 2024-11-20 12:38:58 UTC
(
hide
)
Description:
Bug 38485: Take user's previous change into consideration for holdings tables col vis
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-11-20 12:38:58 UTC
Size:
4.25 KB
patch
obsolete
>From 3a7fab37957546b634f23916d5d397ab7a558a6e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Nov 2024 17:29:56 +0100 >Subject: [PATCH] Bug 38485: Take user's previous change into consideration for > holdings tables col vis > >A lot happened, hard to summarize everything. > >Basically at this point, we have (among other things): >* fixed bug 38118 (but reintroduced it with bug 36640) >* fixed bug 38436 (the original report was that the is_hidden setting > was no longer taken into effect on the holdings tables) > >Here we are trying to deal with making user's previous changes >persistent across the pagination and col vis changes. > >Test plan: >Confirm that hiding checkouts in settings hide the columns >Confirm that showing checkouts then change page (*pagination*, so you need >more than 20 items) and confirm that the columns are still the same >Add a callnumber for an item from page 2 and confirm that the column is >hidden on page 1 and shown on page 2 >Hide callnumber from the settings and confirm that the column is hidden >on pages 1 and 2 >Show callnumber from the holdings page and confirm that the column is >displayed on page 2, go page 1: hidden, go back page 2: displayed. > >And certainly way more other things to test, just confirm that the >behaviours with this patch are consistent with what a end user would >expect. > >Note for QA/self: this is not very nice as column-visibility.dt event >can change in datatables.js and not impact this one. >Also the following nice sounds good and should be added to datatables.js >+ if (recalc === false) return; >--- > .../tables/items/catalogue_detail.inc | 25 +++++++++++++++---- > 1 file changed, 20 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index b669faa42e2..9fa81b87f71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -123,9 +123,11 @@ > } > } > >- function update_columns_visibility(settings){ >- let table = settings.oInstance.api(); >- table.columns().every(function(){ >+ function update_columns_visibility(table_dt, table_settings, user_colvis){ >+ table_dt.columns().visible(true, false); >+ let hidden_ids = _dt_visibility(table_settings, table_dt); >+ table_dt.columns(hidden_ids).visible(false, false); >+ table_dt.columns().every(function(){ > let i = this.index(); > let is_empty = true; > let nodes = this.nodes(); >@@ -136,9 +138,12 @@ > } > }); > if ( is_empty ) { >- table.columns(i).visible(false, false); >+ table_dt.columns(i).visible(false, false); > } > }); >+ for (const [key, value] of Object.entries(user_colvis)) { >+ table_dt.columns(key).visible(value, false); >+ } > } > > >@@ -264,6 +269,7 @@ > otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], > }; > >+ let user_colvis = {holdings: {}, otherholdings: {}}; > let table_nodes = { > holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", > otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", >@@ -849,7 +855,7 @@ > [% END %] > > if ( api.data().length ) { >- update_columns_visibility(settings); >+ update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); > } > > if ( drawcallback ) { drawcallback(this); } >@@ -862,6 +868,15 @@ > filters_options, > ); > >+ let table_dt = items_table.DataTable(); >+ table_dt.on("column-visibility.dt", function(e, settings, column, state, recalc ){ >+ if (recalc === false) return; >+ >+ _dt_add_filters(this, table_dt, filters_options); >+ >+ user_colvis[tab_id][column] = state; >+ >+ }); > return items_table; > } > function safe_link(uri,link_text) { >-- >2.34.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 38485
:
174797
|
174837
|
174840