@@ -9,7 +9,7 @@ jQuery3(document).ready(function () {
99 */
1010 function createDataTable ( table ) {
1111 const defaultConfiguration = {
12- stateSave : typeof Prototype !== 'object' , // do not save state when Prototype is still loaded
12+ stateSave : true ,
1313 language : {
1414 emptyTable : 'Loading - please wait ...'
1515 } ,
@@ -163,56 +163,6 @@ jQuery3(document).ready(function () {
163163 loadTableData ( table , dataTable ) ;
164164 } ) ;
165165 }
166-
167- // TODO: Remove this block once Jenkins 2.426.1 is released
168- // Since Jenkins 2.406 Prototype has been removed.
169- // So we basically do not need to support a custom serialization of the data-tables state
170- // anymore. We can now use the default auto-save functionality of DataTables.
171- if ( typeof Prototype === 'object' ) {
172- // Add event listener that stores the order a user selects
173- table . on ( 'order.dt' , function ( ) {
174- const order = table . DataTable ( ) . order ( ) ;
175- localStorage . setItem ( id + '#orderBy' , order [ 0 ] [ 0 ] ) ;
176- localStorage . setItem ( id + '#orderDirection' , order [ 0 ] [ 1 ] ) ;
177- } ) ;
178-
179- /**
180- * Restores the order of every table by reading the local storage of the browser.
181- * If no order has been stored yet, the table is skipped.
182- * Also saves the default length of the number of table columns.
183- */
184- const orderBy = localStorage . getItem ( id + '#orderBy' ) ;
185- const orderDirection = localStorage . getItem ( id + '#orderDirection' ) ;
186- if ( orderBy && orderDirection ) {
187- const order = [ orderBy , orderDirection ] ;
188- try {
189- dataTable . order ( order ) . draw ( ) ;
190- }
191- catch ( ignore ) { // TODO: find a way to determine the number of columns here
192- dataTable . order ( [ [ 1 , 'asc' ] ] ) . draw ( ) ;
193- }
194- }
195-
196- // Store paging size
197- table . on ( 'length.dt' , function ( e , settings , len ) {
198- localStorage . setItem ( id + '#table-length' , len ) ;
199- } ) ;
200- const storedLength = localStorage . getItem ( id + '#table-length' ) ;
201- if ( $ . isNumeric ( storedLength ) ) {
202- dataTable . page . len ( storedLength ) . draw ( ) ;
203- }
204-
205- // Store search text
206- if ( table . attr ( 'data-remember-search-text' ) === 'true' ) {
207- table . on ( 'search.dt' , function ( ) {
208- localStorage . setItem ( id + '#table-search-text' , dataTable . search ( ) ) ;
209- } ) ;
210- const storedSearchText = localStorage . getItem ( id + '#table-search-text' ) ;
211- if ( storedSearchText ) {
212- dataTable . search ( storedSearchText ) . draw ( ) ;
213- }
214- }
215- }
216166 } ) ;
217167 }
218168
0 commit comments