Bugzilla – Attachment 174588 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: Store bKohaColumnsUseNames in data instead of DT's settings
Bug-38436-Store-bKohaColumnsUseNames-in-data-inste.patch (text/plain), 2.62 KB, created by
Jonathan Druart
on 2024-11-15 15:18:25 UTC
(
hide
)
Description:
Bug 38436: Store bKohaColumnsUseNames in data instead of DT's settings
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-11-15 15:18:25 UTC
Size:
2.62 KB
patch
obsolete
>From c80ea50f47f80e2f40e6f2ebeecf6477ca765f56 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 15 Nov 2024 14:55:20 +0100 >Subject: [PATCH] Bug 38436: Store bKohaColumnsUseNames in data instead of DT's > settings > >DataTable's settings do no longer allow to store custom properties. >Here we are passing bKohaColumnsUseNames to the constructor, but we >cannot retrieve it later from DT's api. > >We need to store it in data(). > >Test plan: >0. Do not apply this patch >1. In _dt_visibility add console.log(settings.bKohaColumnsUseNames); > where relevant >2. Open your browser, clear localStorage entries (we want to reach the > set_default() code) >3. Hit http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4 >Notice that the value is true then false (displayed once per columns). >This is because we are calling _dt_visibility twice: > * with the 'settings' we passed to the constructor: >1044 [hidden_ids, included_ids] = _dt_visibility(table_settings, settings, this) > * from set_default() where we pass the settings retrieved from DT's api >900 [hidden_ids, included_ids] = _dt_visibility(table_settings, settings, $("#"+settings.nTable.id)); > >4. Apply this patch, console.log again and confirm that it's now true. > >Notice that everything is then buggy... >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 9813505421b..ceaa5f44f45 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -746,9 +746,10 @@ function _dt_visibility(table_settings, settings, node){ > var columns_settings = table_settings['columns']; > $(columns_settings).each( function() { > let used_id = counter; >- if ( settings.bKohaColumnsUseNames ) { >+ let use_names = $(node).data('bKohaColumnsUseNames'); >+ if ( use_names ) { > if (!node){ >- console.err("settings.bKohaColumnsUseNames is set but node not passed"); >+ console.err("bKohaColumnsUseNames is set but node not passed"); > return; > } > let selector = '#' + node.attr('id'); >@@ -1060,6 +1061,7 @@ function _dt_save_restore_state(table_settings, external_filter_nodes={}){ > } > } > >+ $(this).data('bKohaColumnsUseNames', settings.bKohaColumnsUseNames); > var table = $(this).dataTable(settings); > > var table_dt = table.DataTable(); >-- >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 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