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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc (-1 / +12 lines)
Lines 60-65 function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) { Link Here
60
60
61
    dt_parameters[ "buttons" ] = [
61
    dt_parameters[ "buttons" ] = [
62
        {
62
        {
63
            fade: 100,
64
            className: "dt_button_clear_filter",
65
            titleAttr: _("Clear filter"),
66
            enabled: false,
67
            text: '<i class="fa fa-lg fa-remove"></i> <span class="dt-button-text">' + _("Clear filter") + '</span>',
68
            action: function ( e, dt, node, config ) {
69
                dt.search( "" ).draw("page");
70
                node.addClass("disabled");
71
            }
72
        },
73
        {
63
            extend: 'colvis',
74
            extend: 'colvis',
64
            fade: 100,
75
            fade: 100,
65
            columns: included_ids,
76
            columns: included_ids,
Lines 106-112 function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) { Link Here
106
        deactivate_filters(id_selector);
117
        deactivate_filters(id_selector);
107
    }
118
    }
108
119
109
    $(".columns_controls,.export_controls").tooltip();
120
    $(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip();
110
121
111
    return table;
122
    return table;
112
}
123
}
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-3 / +39 lines)
Lines 32-40 var dataTablesDefaults = { Link Here
32
        }
32
        }
33
    },
33
    },
34
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
34
    "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>',
35
    "buttons": [],
35
    "buttons": [{
36
        fade: 100,
37
        className: "dt_button_clear_filter",
38
        titleAttr: _("Clear filter"),
39
        enabled: false,
40
        text: '<i class="fa fa-lg fa-remove"></i> <span class="dt-button-text">' + _("Clear filter") + '</span>',
41
        available: function ( dt ) {
42
            // The "clear filter" button is made available if this test returns true
43
            if( dt.settings()[0].aanFeatures.f ){ // aanFeatures.f is null if there is no search form
44
                return true;
45
            }
46
        },
47
        action: function ( e, dt, node ) {
48
            dt.search( "" ).draw("page");
49
            node.addClass("disabled");
50
        }
51
    }],
36
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
52
    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]],
37
    "iDisplayLength": 20
53
    "iDisplayLength": 20,
54
    initComplete: function( settings) {
55
        var tableId = settings.nTable.id
56
        // When the DataTables search function is triggered,
57
        // enable or disable the "Clear filter" button based on
58
        // the presence of a search string
59
        $("#" + tableId ).on( 'search.dt', function ( e, settings ) {
60
            if( settings.oPreviousSearch.sSearch == "" ){
61
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").addClass("disabled");
62
            } else {
63
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled");
64
            }
65
        });
66
    }
38
};
67
};
39
68
40
69
Lines 567-569 function footer_column_sum( api, column_numbers ) { Link Here
567
        $( api.column( column_number ).footer() ).html(total.format_price());
596
        $( api.column( column_number ).footer() ).html(total.format_price());
568
    };
597
    };
569
}
598
}
570
- 
599
600
function filterDataTable( table, column, term ){
601
    if( column ){
602
        table.column( column ).search( term ).draw("page");
603
    } else {
604
        table.search( term ).draw("page");
605
    }
606
}

Return to bug 22811