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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
emlam 2023-04-05 15:51:33 -04:00 committed by Tomas Cohen Arazi
parent a45e79c1f4
commit 4506145b91
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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 %]