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

(-)a/C4/Utils/DataTables/ColumnsSettings.pm (-1 / +12 lines)
Lines 44-50 sub get_columns { Link Here
44
        $column->{cannot_be_toggled} = $c->cannot_be_toggled;
44
        $column->{cannot_be_toggled} = $c->cannot_be_toggled;
45
    }
45
    }
46
46
47
    return $list->{modules}{$module}{$page}{$tablename} || [];
47
    my $columns = $list->{modules}{$module}{$page}{$tablename} || [];
48
49
    # Assign default value if does not exist
50
    $columns = [ map {
51
        {
52
            cannot_be_toggled => exists $_->{cannot_be_toggled} ? $_->{cannot_be_toggled} : 0,
53
            is_hidden => exists $_->{is_hidden} ? $_->{is_hidden} : 0,
54
            columnname => $_->{columnname},
55
        }
56
    } @$columns ];
57
58
    return $columns;
48
}
59
}
49
60
50
sub get_modules {
61
sub get_modules {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc (-6 / +12 lines)
Lines 1-13 Link Here
1
[% USE ColumnsSettings %]
1
[% USE ColumnsSettings %]
2
2
3
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.colvis.css" />
3
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/buttons.dataTables.min.css" />
4
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.colvis.js"></script>
4
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script>
5
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script>
5
6
6
<script type="text/javascript">
7
<script type="text/javascript">
7
function KohaTable(selector, dt_parameters, columns_settings) {
8
function KohaTable(selector, dt_parameters, columns_settings) {
8
    var id = 0;
9
    var id = 0;
9
    var hidden_ids = [];
10
    var hidden_ids = [];
10
    var excluded_ids = [];
11
    var included_ids = [];
11
    $(columns_settings).each( function() {
12
    $(columns_settings).each( function() {
12
        var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
13
        var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
13
        var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
14
        var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
Lines 16-27 function KohaTable(selector, dt_parameters, columns_settings) { Link Here
16
        if ( this['is_hidden'] == "1" ) {
17
        if ( this['is_hidden'] == "1" ) {
17
            hidden_ids.push( used_id );
18
            hidden_ids.push( used_id );
18
        }
19
        }
19
        if ( this['cannot_be_toggled'] == "1" ) {
20
        if ( this['cannot_be_toggled'] == "0" ) {
20
            excluded_ids.push( used_id );
21
            included_ids.push( used_id );
21
        }
22
        }
22
        id++;
23
        id++;
23
    });
24
    });
24
    dt_parameters[ "oColVis" ] = { "aiExclude": excluded_ids };
25
    dt_parameters[ "buttons" ] = [
26
        {
27
            extend: 'colvis',
28
            columns: included_ids,
29
        }
30
    ];
25
    var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
31
    var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
26
32
27
    $(hidden_ids).each(function(index, value) {
33
    $(hidden_ids).each(function(index, value) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc (+2 lines)
Lines 1-5 Link Here
1
[% INCLUDE 'format_price.inc' %]
1
[% INCLUDE 'format_price.inc' %]
2
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
2
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
3
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script>
4
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script>
3
<script type="text/javascript">
5
<script type="text/javascript">
4
//<![CDATA[
6
//<![CDATA[
5
    var MSG_DT_FIRST = _("First");
7
    var MSG_DT_FIRST = _("First");
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js (-2 / +1 lines)
Lines 23-29 var dataTablesDefaults = { Link Here
23
        "sSearch"           : window.MSG_DT_SEARCH || "Search:",
23
        "sSearch"           : window.MSG_DT_SEARCH || "Search:",
24
        "sZeroRecords"      : window.MSG_DT_ZERO_RECORDS || "No matching records found"
24
        "sZeroRecords"      : window.MSG_DT_ZERO_RECORDS || "No matching records found"
25
    },
25
    },
26
    "sDom": 'C<"top pager"ilpf>tr<"bottom pager"ip>',
26
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
27
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
27
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
28
    "iDisplayLength": 20
28
    "iDisplayLength": 20
29
};
29
};
30
- 

Return to bug 15285