Lines 1041-1131
Link Here
|
1041 |
[% INCLUDE 'datatables.inc' %] |
1041 |
[% INCLUDE 'datatables.inc' %] |
1042 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> |
1042 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> |
1043 |
[% INCLUDE 'browser-strings.inc' %] |
1043 |
[% INCLUDE 'browser-strings.inc' %] |
|
|
1044 |
[% INCLUDE 'columns_settings.inc' %] |
1044 |
<script type="text/javascript" src="[% interface %]/js/browser.js"></script> |
1045 |
<script type="text/javascript" src="[% interface %]/js/browser.js"></script> |
|
|
1046 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/table_filters.js"></script> |
1045 |
<script type="text/javascript"> |
1047 |
<script type="text/javascript"> |
1046 |
var browser = KOHA.browser('[% searchid %]', parseInt(biblionumber, 10)); |
1048 |
var browser = KOHA.browser('[% searchid %]', parseInt(biblionumber, 10)); |
1047 |
browser.show(); |
1049 |
browser.show(); |
1048 |
|
1050 |
|
1049 |
function activate_filters(id) { |
|
|
1050 |
var table = $("#" + id + " table"); |
1051 |
if (table.length == 1) { |
1052 |
filters_row = table.find('thead tr.filters_row'); |
1053 |
|
1054 |
var aoColumns = []; |
1055 |
filters_row.find('th').each(function() { |
1056 |
if(this.className === "NoSort"){ |
1057 |
aoColumns.push(null); |
1058 |
} else { |
1059 |
aoColumns.push('text'); |
1060 |
} |
1061 |
}); |
1062 |
|
1063 |
if (table.find('thead tr.columnFilter').length == 0) { |
1064 |
table.dataTable().columnFilter({ |
1065 |
'sPlaceHolder': 'head:after' |
1066 |
, 'aoColumns': aoColumns |
1067 |
}); |
1068 |
filters_row.addClass('columnFilter'); |
1069 |
} |
1070 |
filters_row.show(); |
1071 |
} |
1072 |
|
1073 |
$('#' + id + '_activate_filters') |
1074 |
.html('<i class="fa fa-filter"></i> ' + _("Deactivate filters") ) |
1075 |
.unbind('click') |
1076 |
.click(function() { |
1077 |
deactivate_filters(id); |
1078 |
return false; |
1079 |
}); |
1080 |
} |
1081 |
|
1082 |
function deactivate_filters(id) { |
1083 |
filters_row = $("#" + id + " table").find('thead tr.filters_row'); |
1084 |
|
1085 |
filters_row.find('input[type="text"]') |
1086 |
.val('') // Empty filter text boxes |
1087 |
.trigger('keyup') // Filter (display all rows) |
1088 |
.trigger('blur'); // Reset value to the column name |
1089 |
filters_row.hide(); |
1090 |
|
1091 |
$('#' + id + '_activate_filters') |
1092 |
.html('<i class="fa fa-filter"></i> ' + _("Activate filters") ) |
1093 |
.unbind('click') |
1094 |
.click(function() { |
1095 |
activate_filters(id); |
1096 |
return false; |
1097 |
}); |
1098 |
} |
1099 |
|
1100 |
$(document).ready(function() { |
1051 |
$(document).ready(function() { |
1101 |
var ids = ['holdings', 'otherholdings']; |
1052 |
var ids = ['holdings', 'otherholdings']; |
|
|
1053 |
|
1102 |
for (var i in ids) { |
1054 |
for (var i in ids) { |
1103 |
var id = ids[i]; |
1055 |
var id = ids[i]; |
1104 |
var table = $('#' + id + ' table'); |
1056 |
var dt_parameters = { |
1105 |
|
|
|
1106 |
// Duplicate the table header row for columnFilter |
1107 |
thead_row = table.find('thead tr'); |
1108 |
clone = thead_row.clone().addClass('filters_row'); |
1109 |
clone.find("th.NoSort").html(''); |
1110 |
thead_row.before(clone); |
1111 |
|
1112 |
// Enable sorting |
1113 |
table.dataTable($.extend(true, {}, dataTablesDefaults, { |
1114 |
'sDom': 't', |
1057 |
'sDom': 't', |
1115 |
'bPaginate': false, |
1058 |
'bPaginate': false, |
1116 |
'bAutoWidth': false, |
1059 |
'bAutoWidth': false, |
1117 |
"aoColumnDefs": [ |
1060 |
"aoColumnDefs": [ |
1118 |
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } |
1061 |
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } |
1119 |
] |
1062 |
] |
1120 |
})); |
1063 |
}; |
1121 |
|
1064 |
var table = KohaTable(id, dt_parameters, null, 'with_filters'); |
1122 |
// Show a link to activate filtering |
|
|
1123 |
link = $('<a>') |
1124 |
.attr('href', '#') |
1125 |
.attr('id', id + '_activate_filters'); |
1126 |
$("." + id + "_table_controls").prepend(link); |
1127 |
deactivate_filters(id); |
1128 |
} |
1065 |
} |
|
|
1066 |
|
1129 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1067 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1130 |
$("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { |
1068 |
$("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { |
1131 |
'sDom': 't', |
1069 |
'sDom': 't', |