Bugzilla – Attachment 172365 Details for
Bug 38079
Add ability to choose sorting for holdings table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38079: Add ability to choose sorting for holdings tables on details page
Bug-38079-Add-ability-to-choose-sorting-for-holdin.patch (text/plain), 5.46 KB, created by
Nick Clemens (kidclamp)
on 2024-10-03 17:23:23 UTC
(
hide
)
Description:
Bug 38079: Add ability to choose sorting for holdings tables on details page
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-10-03 17:23:23 UTC
Size:
5.46 KB
patch
obsolete
>From 31dbb3156a46d7d0f6600baf1d14676e1a7ff7fe Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 3 Oct 2024 17:15:50 +0000 >Subject: [PATCH] Bug 38079: Add ability to choose sorting for holdings tables > on details page > >This patch adds a new option 'default' to the sorting options in tables settings > >We need this so that we can add the option to define sorting, without setting a new >default as the holdings table currently uses 'search_ordered' for a specific sorting >when no sorting is provided > >To test: > 1 - Add many items to a record, with various values > 2 - View the holdings tab on details, note the order > 3 - Apply patch, restart_all, reload > 4 - Confirm order not changed > 5 - Click 'Configure' > 6 - Scroll to holdings table > 7 - Change page size and save (noting sort is set to default) > 8 - Reload and confirm the order has not changed > 9 - Now change the sorting in the table settings >10 - Reload and confirm the sorting is saved >--- > admin/columns_settings.yml | 1 + > koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc | 2 +- > .../intranet-tmpl/prog/en/modules/admin/columns_settings.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 2 +- > koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue | 3 ++- > 5 files changed, 6 insertions(+), 3 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 82548ed2c56..ba6cf0aa054 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -372,6 +372,7 @@ modules: > detail: > holdings_table: > default_display_length: 20 >+ default_sort_order: default > columns: > - > columnname: holdings_checkbox >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 3da3511cf12..a5cb2baeb7f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -206,7 +206,7 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters) { > // pageLength needs to be a number, not a string, or it can cause issues with DataTable's next button. > new_parameters["pageLength"] = parseInt(table_settings['default_display_length']); > } >- if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null ) { >+ if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null && table_settings['default_sort_order'] != 'default' ) { > new_parameters["order"] = [[ table_settings['default_sort_order'], 'asc' ]]; > } > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >index 28a3b2a0ead..d11ff8a0e67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >@@ -138,6 +138,7 @@ > <p> > Default sort order: > <select name="[% pagename | html %]|[% tablename | html %]_default_sort_order"> >+ <option value="default">Default (none)</option> > [% FOR column IN tables.$pagename.$tablename.columns %] > [% IF table_settings.default_sort_order == loop.count - 1 %] > <option value="[% loop.count - 1 %]" selected="selected">[% column.columnname | html %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 5e319843062..a08766e61dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -989,7 +989,7 @@ function _dt_add_delay(table_dt, table_node, delay_ms) { > if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { > settings["pageLength"] = table_settings['default_display_length']; > } >- if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null ) { >+ if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null && table_settings['default_sort_order'] != 'default' ) { > settings["order"] = [[ table_settings['default_sort_order'], 'asc' ]]; > } > } >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 d3a03bd9743..a05ad53e0ab 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -153,7 +153,8 @@ export default { > } > if ( > this.table_settings.hasOwnProperty("default_sort_order") && >- this.table_settings.default_sort_order != null >+ this.table_settings.default_sort_order != null && >+ this.table_settings.default_sort_order != "default" > ) { > this.options.order = [ > [this.table_settings.default_sort_order, "asc"], >-- >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 38079
: 172365