@@ -62,7 +62,7 @@ function start_datatables( $elements ) {
6262 const single_value = search [ ( id_plugin ? id_plugin : "" ) + "_search_" + id ] ? search [ ( id_plugin ? id_plugin : "" ) + "_search_" + id ] : "" ;
6363
6464 column_search . push ( {
65- "sSearch " : single_value ,
65+ "search " : single_value ,
6666 } ) ;
6767 } ) ;
6868
@@ -78,8 +78,8 @@ function start_datatables( $elements ) {
7878 deferRender : true ,
7979 ordering : true ,
8080 searching : true ,
81- aaSorting : [ ] ,
82- aoSearchCols : column_search ,
81+ order : [ ] ,
82+ searchCols : column_search ,
8383 scrollY : "60vh" ,
8484 scrollX : '100%' ,
8585 retrieve : true ,
@@ -287,13 +287,20 @@ function initComplete(settings) {
287287 const $this = $ ( this ) ;
288288 const search = getTableSearch ( ) ;
289289
290- api . columns ( '.search' ) . every ( function ( ) {
290+ // In DataTables 2.x, il selettore .search potrebbe non funzionare come previsto
291+ // Usiamo un approccio più robusto basato sugli ID delle colonne
292+ api . columns ( ) . every ( function ( ) {
291293 const column = this ;
294+ const header = $ ( column . header ( ) ) ;
295+
296+ // Verifica se la colonna ha la classe 'search'
297+ if ( ! header . hasClass ( 'search' ) ) {
298+ return ;
299+ }
292300
293301 // Valore predefinito della ricerca
294302 let tempo ;
295303 const id_plugin = $this . data ( 'idplugin' ) ;
296- const header = $ ( column . header ( ) ) ;
297304 const name = header . attr ( 'id' ) . replace ( 'th_' , '' ) ;
298305
299306 const value = search [ ( id_plugin ? id_plugin : "" ) + "_search_" + name ] ? search [ ( id_plugin ? id_plugin : "" ) + "_search_" + name ] : '' ;
0 commit comments