View | Details | Raw Unified | Return to bug 21852
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt (-3 / +1 lines)
Lines 280-287 Link Here
280
        $(document).ready(function(){
280
        $(document).ready(function(){
281
281
282
            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
282
            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
283
            var od_table = localStorage.getItem("DataTables_overduest_/cgi-bin/koha/circ/overdue.pl");
284
            var updated_settings = get_columns_saved_state( od_table, columns_settings );
285
283
286
            KohaTable("overduest", {
284
            KohaTable("overduest", {
287
                "sPaginationType": "four_button",
285
                "sPaginationType": "four_button",
Lines 292-298 Link Here
292
                ],
290
                ],
293
                "autoWidth": false,
291
                "autoWidth": false,
294
                "stateSave": true
292
                "stateSave": true
295
            }, updated_settings);
293
            }, columns_settings);
296
        });
294
        });
297
  </script>
295
  </script>
298
[% END %]
296
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-29 lines)
Lines 604-634 function filterDataTable( table, column, term ){ Link Here
604
        table.search( term ).draw("page");
604
        table.search( term ).draw("page");
605
    }
605
    }
606
}
606
}
607
608
/* get_columns_saved_state checks for a DataTables configuration saved
609
 * in the browser's local storage. If it is present, the columns
610
 * configuration supplied by Koha is overwritten
611
 *
612
 * It takes two parameters:
613
 *  - localstorage_config, the DataTables saved state object from local storage
614
 *  - columns_settings, the columns settings object supplied by the template
615
 */
616
617
function get_columns_saved_state( localstorage_config, columns_settings ){
618
    var tables = JSON.parse( localstorage_config );
619
    // if a table configuration was found in local storage, parse it
620
    if( tables ){
621
        var stateSave_column_visibility = [];
622
        $(tables.columns).each(function(){
623
            stateSave_column_visibility.push( this.visible === true ? 0 : 1 );
624
        });
625
        $.each( columns_settings, function( index, key ){
626
            if( stateSave_column_visibility[ index ] !== columns_settings[key] ){
627
                columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ];
628
            }
629
        });
630
        return columns_settings;
631
    } else {
632
        return columns_settings;
633
    }
634
}
635
- 

Return to bug 21852