From 4506145b9144ae15854d51daad1cddedd467fb6f Mon Sep 17 00:00:00 2001 From: emlam Date: Wed, 5 Apr 2023 15:51:33 -0400 Subject: [PATCH] Bug 33426: Add DataTables saveState to suggestion.tt To test: 1. In the staff client, go to Purchase Suggestion management page and add a suggestion if needed to make the table display. 2. Make some changes to the table settings (hide/show columns, change sort column, and/or change number of rows to display) 3. Navigate to a different page. 4. Navigate back to Purchase Suggestions page. Note that the table settings have been reset. 5. Apply patch and restart_all 6. Repeat steps 1-4. Note that this time the changes to the table settings were preserved. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/suggestion/suggestion.tt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 937fe63e20..657a2a5cbd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1344,12 +1344,16 @@ } table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %] + var saved_table = localStorage.getItem("DataTables_suggestions_/cgi-bin/koha/suggestion/suggestion.pl"); + var updated_settings = get_columns_saved_state(saved_table, table_settings); + [% FOREACH suggestion IN suggestions %] [% IF suggestion.suggestions.size %] KohaTable("table_[% loop.count| html %]", { "sorting": [[ 4, "asc" ]], "autoWidth": false, - }, table_settings ); + "stateSave": true, + }, updated_settings ); [% END %] [% END %] -- 2.39.5