From c7c15cfc768e2a63e579f39594e87b14470e837e Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Mon, 22 May 2023 12:23:51 +0200 Subject: [PATCH] Enable built-in auto-save functionality of DataTables. Do not use custom serialization anymore when Prototype is not loaded. Requires Jenkins 2.406 or newer. --- README.adoc | 6 +----- src/main/webapp/js/table.js | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.adoc b/README.adoc index 7ef64380..a8a26c5f 100644 --- a/README.adoc +++ b/README.adoc @@ -57,11 +57,7 @@ with the following piece of code:
- data-remember-search-text="true" - > + class="table table-striped display" id="id"> [...]
diff --git a/src/main/webapp/js/table.js b/src/main/webapp/js/table.js index e1c73ad6..ae36b2fd 100644 --- a/src/main/webapp/js/table.js +++ b/src/main/webapp/js/table.js @@ -145,7 +145,10 @@ jQuery3(document).ready(function () { }); } - if (!table.hasClass("custom-persistence-off")) { + // Since Jenkins 2.406 Prototype has been removed from core. + // So we basically do not need to support a custom serialization of the data-tables state + // anymore. We can now use the default auto-save functionality of DataTables. + if (typeof Prototype === 'object') { // Add event listener that stores the order a user selects table.on('order.dt', function () { const order = table.DataTable().order();