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 278-285 Link Here
278
        $(document).ready(function(){
278
        $(document).ready(function(){
279
279
280
            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
280
            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
281
            var od_table = localStorage.getItem("DataTables_overduest_/cgi-bin/koha/circ/overdue.pl");
282
            var updated_settings = get_columns_saved_state( od_table, columns_settings );
283
281
284
            KohaTable("overduest", {
282
            KohaTable("overduest", {
285
                "sPaginationType": "four_button",
283
                "sPaginationType": "four_button",
Lines 290-296 Link Here
290
                ],
288
                ],
291
                "autoWidth": false,
289
                "autoWidth": false,
292
                "stateSave": true
290
                "stateSave": true
293
            }, updated_settings);
291
            }, columns_settings);
294
        });
292
        });
295
  </script>
293
  </script>
296
[% END %]
294
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-29 lines)
Lines 567-597 function footer_column_sum( api, column_numbers ) { Link Here
567
        $( api.column( column_number ).footer() ).html(total.format_price());
567
        $( api.column( column_number ).footer() ).html(total.format_price());
568
    };
568
    };
569
}
569
}
570
571
/* get_columns_saved_state checks for a DataTables configuration saved
572
 * in the browser's local storage. If it is present, the columns
573
 * configuration supplied by Koha is overwritten
574
 *
575
 * It takes two parameters:
576
 *  - localstorage_config, the DataTables saved state object from local storage
577
 *  - columns_settings, the columns settings object supplied by the template
578
 */
579
580
function get_columns_saved_state( localstorage_config, columns_settings ){
581
    var tables = JSON.parse( localstorage_config );
582
    // if a table configuration was found in local storage, parse it
583
    if( tables ){
584
        var stateSave_column_visibility = [];
585
        $(tables.columns).each(function(){
586
            stateSave_column_visibility.push( this.visible === true ? 0 : 1 );
587
        });
588
        $.each( columns_settings, function( index, key ){
589
            if( stateSave_column_visibility[ index ] !== columns_settings[key] ){
590
                columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ];
591
            }
592
        });
593
        return columns_settings;
594
    } else {
595
        return columns_settings;
596
    }
597
}
598
- 

Return to bug 21852