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

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-6 / +12 lines)
Lines 53-71 var dataTablesDefaults = { Link Here
53
    "fixedHeader": true,
53
    "fixedHeader": true,
54
    initComplete: function( settings) {
54
    initComplete: function( settings) {
55
        var tableId = settings.nTable.id
55
        var tableId = settings.nTable.id
56
        var state =  $("#" + tableId ).DataTable().state();
57
        state && toggledClearFilter(state.search.search, tableId);
56
        // When the DataTables search function is triggered,
58
        // When the DataTables search function is triggered,
57
        // enable or disable the "Clear filter" button based on
59
        // enable or disable the "Clear filter" button based on
58
        // the presence of a search string
60
        // the presence of a search string
59
        $("#" + tableId ).on( 'search.dt', function ( e, settings ) {
61
        $("#" + tableId ).on( 'search.dt', function ( e, settings ) {
60
            if( settings.oPreviousSearch.sSearch == "" ){
62
            toggledClearFilter(settings.oPreviousSearch.sSearch, tableId);
61
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").addClass("disabled");
62
            } else {
63
                $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled");
64
            }
65
        });
63
        });
66
    }
64
    }
67
};
65
};
68
66
67
function toggledClearFilter(searchText, tableId){
68
    if( searchText == "" ){
69
        $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").addClass("disabled");
70
    } else {
71
        $("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled");
72
    }
73
}
74
69
75
70
// Return an array of string containing the values of a particular column
76
// Return an array of string containing the values of a particular column
71
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
77
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
Lines 846-851 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
846
852
847
        if ( add_filters ) {
853
        if ( add_filters ) {
848
            var table_dt = table.DataTable();
854
            var table_dt = table.DataTable();
855
            // table_dt.on('search', console.log);
849
            $(this).find('thead tr:eq(1) th').each( function (i) {
856
            $(this).find('thead tr:eq(1) th').each( function (i) {
850
                var is_searchable = table_dt.settings()[0].aoColumns[i].bSearchable;
857
                var is_searchable = table_dt.settings()[0].aoColumns[i].bSearchable;
851
                if ( is_searchable ) {
858
                if ( is_searchable ) {
852
- 

Return to bug 32016