Skip to content

Commit c7c15cf

Browse files
committed
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.
1 parent 831d74b commit c7c15cf

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

README.adoc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ with the following piece of code:
5757
5858
<div class="table-responsive">
5959
<table
60-
class="table table-hover table-striped display"
61-
id="id"
62-
<!-- enable to remember last search text. Per default false -->
63-
data-remember-search-text="true"
64-
>
60+
class="table table-striped display" id="id">
6561
[...]
6662
</table>
6763
</div>

src/main/webapp/js/table.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ jQuery3(document).ready(function () {
145145
});
146146
}
147147

148-
if (!table.hasClass("custom-persistence-off")) {
148+
// Since Jenkins 2.406 Prototype has been removed from core.
149+
// So we basically do not need to support a custom serialization of the data-tables state
150+
// anymore. We can now use the default auto-save functionality of DataTables.
151+
if (typeof Prototype === 'object') {
149152
// Add event listener that stores the order a user selects
150153
table.on('order.dt', function () {
151154
const order = table.DataTable().order();

0 commit comments

Comments
 (0)