Skip to content

Commit

Permalink
Merge pull request #356 from jenkinsci/no-prototype
Browse files Browse the repository at this point in the history
Enable built-in auto-save functionality of DataTables
  • Loading branch information
uhafner authored Jun 1, 2023
2 parents 0ade40e + c7c15cf commit dd94396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ with the following piece of code:
<div class="table-responsive">
<table
class="table table-hover table-striped display"
id="id"
<!-- enable to remember last search text. Per default false -->
data-remember-search-text="true"
>
class="table table-striped display" id="id">
[...]
</table>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/main/webapp/js/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit dd94396

Please sign in to comment.