Bugzilla – Attachment 173130 Details for
Bug 37395
Cannot hide columns in ERM tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37395: Fix columns visibility on Vue tables
Bug-37395-Fix-columns-visibility-on-Vue-tables.patch (text/plain), 3.19 KB, created by
Pedro Amorim
on 2024-10-22 11:53:07 UTC
(
hide
)
Description:
Bug 37395: Fix columns visibility on Vue tables
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-10-22 11:53:07 UTC
Size:
3.19 KB
patch
obsolete
>From 27a3732ba3bf6c2046de7d9f484664f5f1d9ffd9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 24 Sep 2024 14:20:59 +0200 >Subject: [PATCH] Bug 37395: Fix columns visibility on Vue tables > >On bug 33066 we reworked a lot of datatables.js to make the JS function >reusable from the Vue component (and especially the KohaTable >component). I guess the regression comes from this change, but I am >surprised that we didn't catch it when testing. > >The was a mistake for _dt_visibility, we didn't pass the node. Actually >we cannot pass it as we do not have it yet. > >This "node" variable is only used when bKohaColumnsUseNames is passed >(ie. we do not rely on the order of the columns but we need to rely on >their data-colname attributes). > >There is then a limitation here: we cannot use bKohaColumnsUseNames from >Vue, but we do not yet. > >An ideal fix would be too big for now, especially for an hypothetic use >case. > >Test plan: >Confirm that the "Columns" button are now back for the tables of the Vue >apps (ERM, Preservation) and that the settings are taken into account >(hide by default, etc.) > >Signed-off-by: Olivier V <olivier.vezina@inLibro.com> >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 5f5d81a34f..bfa9514f7d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -774,16 +774,24 @@ function _dt_buttons(params){ > return buttons; > } > >-function _dt_visibility(node, table_settings, settings){ >+function _dt_visibility(table_settings, settings, node){ > var counter = 0; > let hidden_ids = []; > let included_ids = []; > if ( table_settings ) { > var columns_settings = table_settings['columns']; > $(columns_settings).each( function() { >- let selector = '#' + node.attr('id'); >- var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector + ' th' ); >- var used_id = settings.bKohaColumnsUseNames ? named_id : counter; >+ let used_id = counter; >+ if ( settings.bKohaColumnsUseNames ) { >+ if (!node){ >+ console.err("settings.bKohaColumnsUseNames is set but node not passed"); >+ return; >+ } >+ let selector = '#' + node.attr('id'); >+ var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector + ' th' ); >+ used_id = named_id; >+ } >+ > if ( used_id == -1 ) return; > > if ( this['is_hidden'] == "1" ) { >@@ -969,7 +977,7 @@ function _dt_add_delay(table_dt, table_node, delay_ms) { > } > > let hidden_ids, included_ids; >- [hidden_ids, included_ids] = _dt_visibility(this, table_settings, settings) >+ [hidden_ids, included_ids] = _dt_visibility(table_settings, settings, this) > > settings["buttons"] = _dt_buttons({included_ids, settings, table_settings}); > >-- >2.39.5
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 37395
:
171925
|
171978
| 173130