From 01123d7bd097cfbeaaa5469f8d66814a1cd50001 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 --- .../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 bb1efb003e..47b9382274 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1368,12 +1368,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": [[ 3, "asc" ]], "autoWidth": false, - }, table_settings ); + "stateSave": true, + }, updated_settings ); [% END %] [% END %] -- 2.40.0