Bugzilla – Attachment 174754 Details for
Bug 38436
Adjust code for column visibility (after DataTables upgrade)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38436: (follow-up) Fix visibility when bKohaColumnsUseNames is not set
Bug-38436-follow-up-Fix-visibility-when-bKohaColum.patch (text/plain), 2.47 KB, created by
Paul Derscheid
on 2024-11-18 17:05:54 UTC
(
hide
)
Description:
Bug 38436: (follow-up) Fix visibility when bKohaColumnsUseNames is not set
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-11-18 17:05:54 UTC
Size:
2.47 KB
patch
obsolete
>From 8fc85322cd79d491e1ddf84c51d57b098066b22d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 18 Nov 2024 14:47:57 +0100 >Subject: [PATCH] Bug 38436: (follow-up) Fix visibility when > bKohaColumnsUseNames is not set > >Previous commit didn't adjust columns_settings.inc > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > .../prog/en/includes/columns_settings.inc | 22 +++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >index 19fd2c7c71..4a5b212248 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -170,13 +170,31 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters, defa > > dt_parameters[ "buttons" ] = ['clear_filter']; > >- let included_columns = table_settings.columns.filter(c => !c.cannot_be_toggled); >+ // Retrieving bKohaColumnsUseNames from the options passed to the constructor, not DT settings >+ // But ideally should be retrieved using table.data() >+ let use_names = dt_parameters.bKohaColumnsUseNames; >+ let included_columns = []; >+ if (table_settings) { >+ if (use_names) { >+ // bKohaColumnsUseNames is set, identify columns by their data-colname >+ included_columns = table_settings.columns >+ .filter(c => !c.cannot_be_toggled) >+ .map(c => "[data-colname='%s']".format(c.columnname)) >+ .join(","); >+ } else { >+ // Not set, columns are ordered the same than in the columns settings >+ included_columns = table_settings.columns >+ .map((c, i) => (!c.cannot_be_toggled ? i : null)) >+ .filter(i => i !== null); >+ } >+ } >+ > if( included_columns.length > 0 ){ > dt_parameters[ "buttons" ].push( > { > extend: 'colvis', > fade: 100, >- columns: included_columns.map(c => "[data-colname='%s']".format(c.columnname)).join(','), >+ columns: included_columns, > className: "columns_controls", > titleAttr: _("Columns settings"), > text: '<i class="fa fa-lg fa-gear"></i> <span class="dt-button-text">' + _("Columns") + '</span>', >-- >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 38436
:
174587
|
174588
|
174589
|
174590
|
174591
|
174592
|
174593
|
174594
|
174595
|
174634
|
174641
|
174642
|
174688
|
174689
|
174690
|
174691
|
174692
|
174693
|
174694
|
174695
|
174696
|
174697
|
174698
|
174699
|
174700
|
174701
|
174702
|
174721
|
174722
|
174723
|
174724
|
174725
|
174726
|
174727
|
174728
|
174729
|
174730
|
174731
|
174732
|
174733
|
174734
|
174735
|
174736
|
174740
|
174741
|
174742
|
174743
|
174744
|
174745
|
174746
|
174747
|
174748
|
174749
|
174750
|
174751
|
174752
|
174753
|
174754
|
174755
|
174756
|
174766
|
174767
|
174768
|
174769
|
174770
|
174771
|
174772
|
174773
|
174774
|
174775
|
174776
|
174777
|
174778
|
174779
|
174780
|
174781
|
174782
|
174821
|
174967