Bug 38255: Replace dataTable constructor with kohaTable - Staff

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-11-28 16:20:24 +01:00 committed by Katrin Fischer
parent b4662eb60a
commit e9b8004d19
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
98 changed files with 858 additions and 991 deletions

View File

@ -1231,17 +1231,18 @@
$(document).ready(function() {
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %];
[% IF !(Koha.Preference('EDIFACT') && ediaccount) %]
// FIXME This cannot work correctly without bKohaColumnsUseNames
table_settings['columns'].splice(18, 1);
[% END %]
KohaTable("orders", {
"pagingType": "full",
"autoWidth": false,
"exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18[% IF (Koha.Preference('EDIFACT') && ediaccount) %],19[% END %]],
$("#orders").kohaTable({
pagingType: "full",
autoWidth: false,
exportColumns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18[% IF (Koha.Preference('EDIFACT') && ediaccount) %],19[% END %]],
}, table_settings);
var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
"pagingType": "full"
} ) );
$("#cancelledorderst").kohaTable({
pagingType: "full"
});
$("#reopenform").on("submit",function(e){
var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));

View File

@ -423,34 +423,32 @@
$("#basket_groups a[href='#opened']").tab("show");
[% END %]
[% UNLESS ( grouping ) %]
$("table").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
],
"autoWidth": false,
"pagingType": "full"
} ));
let dt_params = {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
autoWidth: false,
pagingType: "full",
};
$("#ungrouped").kohaTable(dt_params);
$("#grouped").kohaTable(dt_params);
$("#basket_group_opened").kohaTable(dt_params);
$("#basket_group_closed").kohaTable(dt_params);
[% ELSE %]
grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
'autoWidth': false,
"language": {
"emptyTable": _("There are no baskets in this group")
}
} ));
ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
'autoWidth': false,
"language": {
"emptyTable": _("There are no ungrouped baskets")
}
} ));
grouped = $("#grouped").kohaTable({
dom: "t",
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
autoWidth: false,
language: {
emptyTable: _("There are no baskets in this group"),
},
});
ungrouped = $("#ungrouped").kohaTable({
dom: "t",
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
autoWidth: false,
language: {
emptyTable: _("There are no ungrouped baskets"),
},
});
[% END %]
$("#basketgroupcolumns").on("click", ".addtogroup", function(){

View File

@ -263,16 +263,14 @@
[% Asset.js("js/acq.js") | $raw %]
<script>
$(document).ready(function () {
$("table.baskets").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
paginate: false,
searching: false,
info: false,
order: [[1, "asc"]],
columnDefs: [{ targets: [-1], orderable: false }],
})
);
$("table.baskets").kohaTable({
dom: "t",
paginate: false,
searching: false,
info: false,
order: [[1, "asc"]],
columnDefs: [{ targets: [-1], orderable: false }],
});
$("#supplierlist").change(function () {
var id = $(this).find("option:selected").val();
window.location.href = "#vendor" + id;

View File

@ -116,18 +116,18 @@
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#invoice_files_details_table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
info: false,
paging: false,
searching: false,
dom: "t",
})
);
$(".delete_file").click(function () {
return confirm(_("Are you sure you want to delete this file?"));
$(document).ready(function() {
$("#invoice_files_details_table").kohaTable({
columnDefs: [
{ "targets": [ -1, -2 ], "orderable": false, "searchable": false }
],
info: false,
paging: false,
searching: false,
dom: "t"
}));
$(".delete_file").click(function(){
return ( confirm( _("Are you sure you want to delete this file?") ) );
});
});
</script>

View File

@ -560,22 +560,20 @@
}
$(document).ready(function() {
$("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
"info": false,
"paging": false,
"searching": false,
"dom": "t",
"columnDefs": [
{ "type": "anti-the", "targets": [ "anti-the" ] }
]
}));
$("#orderst").kohaTable({
info: false,
paging: false,
searching: false,
dom: "t",
columnDefs: [{ type: "anti-the", targets: ["anti-the"] }],
});
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
$("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
"info": false,
"paging": false,
"searching": false,
"dom": "t"
}));
$("#invoice_files_table").kohaTable({
info: false,
paging: false,
searching: false,
dom: "t",
});
[% END %]
$("#show_all_details").click(function(){
updateColumnsVisibility( $(this).is(":checked") );

View File

@ -498,16 +498,14 @@
});
});
var resultst = $("table.result").dataTable(
$.extend(true, {}, dataTablesDefaults, {
paging: false,
columnDefs: [
{ orderable: false, targets: [1, -1] },
{ visible: false, targets: [0] },
],
autoWidth: false,
})
);
var resultst = $("table.result").kohaTable({
paging: false,
columnDefs: [
{ orderable: false, targets: [1, -1] },
{ visible: false, targets: [0] },
],
autoWidth: false,
});
$(".show_only_subscription").prop("checked", false);

View File

@ -124,15 +124,13 @@
}
$(document).ready(function () {
$("#srlt").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
})
);
$("#srlt").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
});
$("#show_only_renewed").click(function () {
updateRowsVisibility($(this).is(":checked"));

View File

@ -118,13 +118,13 @@
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ 0 ], "visible": false, "searchable": true }, // must be searchable for filtering
{ "targets": [ -1 ], "orderable": false, "searchable": false },
var suggestionst = $("#suggestionst").kohaTable({
columnDefs: [
{ targets: [0], visible: false, searchable: true }, // must be searchable for filtering
{ targets: [-1], orderable: false, searchable: false },
],
"pagingType": "full"
}));
pagingType: "full",
});
let table_dt = suggestionst.DataTable();
$("#show_only_mine").on('click', function(e){
e.preventDefault();

View File

@ -120,12 +120,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#spent").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ type: "anti-the", targets: ["anti-the"] }],
pagingType: "full",
})
);
$("#spent").kohaTable({
columnDefs: [{ type: "anti-the", targets: ["anti-the"] }],
pagingType: "full",
});
});
</script>
[% END %]

View File

@ -369,19 +369,21 @@
});
if ( $("#receivedt").length ) {
var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
"stateSave": true, // We do not have table settings on this table
"pageLength": 10,
"lengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
"columnDefs": [
{ "targets": [ 5, -1 ], "orderable": false, "searchable": false },
var receivedt = $("#receivedt").kohaTable({
stateSave: true, // We do not have table settings on this table
pageLength: 10,
lengthMenu: [
[5, 10, 20, 50, 100, -1],
[5, 10, 20, 50, 100, _("All")],
],
"columns": [
{ "type": "html" },
{ "type": "html" },
{ "type": "html" },
{ "type": "num-html" },
{ "type": "anti-the" },
columnDefs: [{ targets: [5, -1], orderable: false, searchable: false }],
columns: [
{ type: "html" },
{ type: "html" },
{ type: "html" },
{ type: "num-html" },
{ type: "anti-the" },
null,
null,
null,
null,
@ -389,10 +391,9 @@
null,
null,
null,
null
],
"pagingType": "full"
}));
pagingType: "full",
});
}
var options = {

View File

@ -270,11 +270,9 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
var parcelst = $("#parcelst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
paginate: false,
})
);
$("#parcelst").kohaTable({
paginate: false,
});
//keep a copy of all budgets before removing the inactives
var budgetId = $("#shipmentcost_budgetid");

View File

@ -130,12 +130,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#spent").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ type: "anti-the", targets: ["anti-the"] }],
pagingType: "full",
})
);
$("#spent").kohaTable({
columnDefs: [{ type: "anti-the", targets: ["anti-the"] }],
pagingType: "full",
});
});
</script>
[% END %]

View File

@ -687,12 +687,12 @@
}
$(document).ready(function() {
var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }
var contractst = $("#contractst").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: [ 'NoSort' ] }
],
"dom": 't'
} ) );
dom: 't'
} );
$('body').on('click', '.delete-contact', null, delete_contact);
$('#add-contact').click(add_contact);
$('body').on('click', '.contact_acqprimary', null, function () {

View File

@ -191,12 +191,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
var uncertainpricet = $("#uncertainpricet").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }],
pagingType: "full",
})
);
var uncertainpricet = $("#uncertainpricet").kohaTable({
columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }],
pagingType: "full",
});
$(".check_uncertain").on("change", function () {
var form = document.getElementById("uncertainprices");
var ordernumber = $(this).data("ordernumber");

View File

@ -333,18 +333,16 @@
[% Asset.js("js/z3950_search.js") | $raw %]
<script>
$(document).ready(function () {
var resultst = $("#resultst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [-1, -2], orderable: false, searchable: false },
{ targets: [1], type: "nsb-nse" },
],
order: [[1, "asc"]],
paginate: false,
searching: false,
info: false,
})
);
var resultst = $("#resultst").kohaTable({
columnDefs: [
{ targets: [-1, -2], orderable: false, searchable: false },
{ targets: [1], type: "nsb-nse" },
],
order: [[1, "asc"]],
paginate: false,
searching: false,
info: false,
});
InitLastAction();
});
</script>

View File

@ -308,19 +308,17 @@
$("#selecttable").submit();
});
$("#fieldst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
autoWidth: false,
dom: 't<"bottom pager"ilpf>',
pagingType: "full",
lengthMenu: [
[10, 20, 50, 100, -1],
[10, 20, 50, 100, "All"],
],
pageLength: 20,
order: [[0, "asc"]],
})
);
$("#fieldst").kohaTable({
autoWidth: false,
dom: 't<"bottom pager"ilpf>',
pagingType: "full",
lengthMenu: [
[10, 20, 50, 100, -1],
[10, 20, 50, 100, "All"],
],
pageLength: 20,
order: [[0, "asc"]],
});
$("#add_field").on("submit", function () {
if ($("#marcfield").length && $("select[name='authorised_value_category']").length) {

View File

@ -567,18 +567,19 @@
$("#budgetsTabs li:eq([% tab | html %]) a").tab("show");
[% END %]
$("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
],
"pagingType": "full",
"autoWidth": false
} ) );
let dt_params = {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
autoWidth: false,
};
$("#activeperiodst").kohaTable(dt_params);
$("#inactiveperiodst").kohaTable(dt_params);
[% IF close_form %]
$("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": "t"
}));
$("#budgeth").kohaTable({
dom: "t",
});
$("#move_form").submit(function(){
var budget_from = "[% budget_period_description | html %]";
var budget_to = $("#to_budget_period_id").find("option:selected").html();
@ -588,7 +589,7 @@
});
[% END %]
[% IF closed %]
var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
var oTable = $("#closed_report").kohaTable({
// The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
"drawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
@ -624,7 +625,7 @@
"orderFixed": [[ 1, 'asc' ]],
"autoWidth": false,
"pagingType": "full_numbers"
}));
});
[% END %]
$("#add_modify_budget").validate({
rules: {

View File

@ -437,13 +437,11 @@
[% Asset.js("js/admin-menu.js") | $raw %]
<script>
$(document).ready(function() {
$("#table_authsubfieldstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
$("#table_authsubfieldstructure").kohaTable({
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
aaSorting: [],
paginate: false
}));
paginate: false,
});
if ($("#subfieldtabs").length > 0) {
[% IF ( tagsubfield && tagsubfield == "@") %]

View File

@ -289,12 +289,10 @@
[% Asset.js("js/admin-menu.js") | $raw %]
<script>
$(document).ready(function () {
$("#table_authtagstructure").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
})
);
$("#table_authtagstructure").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
});
});
</script>
[% END %]

View File

@ -135,54 +135,55 @@
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#CheckAll").on("click", function (e) {
$(document).ready(function(){
$("#CheckAll").on("click", function(e){
e.preventDefault();
$(".cb").each(function () {
$(".cb").each(function(){
$(this).prop("checked", true);
});
});
$("#UncheckAll").on("click", function (e) {
$("#UncheckAll").on("click", function(e){
e.preventDefault();
$(".cb").each(function () {
$(".cb").each(function(){
$(this).prop("checked", false);
});
});
if ($("#transferlimit_tabs .tab-pane.active").length < 1) {
$("#transferlimit_tabs a:first").tab("show");
if( $("#transferlimit_tabs .tab-pane.active").length < 1 ){
$("#transferlimit_tabs a:first").tab("show");
}
$("#branchselect").change(function () {
$("#selectlibrary").submit();
});
$('#branchselect').change(function() {
$('#selectlibrary').submit();
});
var checkall = $(".checkall");
var uncheckall = $(".uncheckall");
$(checkall).on("click", function (e) {
$(checkall).on("click", function(e){
e.preventDefault();
var tid = $(this).data("cb");
$(".cb" + tid).each(function () {
$(".cb" + tid ).each(function(){
$(this).prop("checked", true);
});
})
});
$(uncheckall).on("click", function (e) {
$(uncheckall).on("click", function(e){
e.preventDefault();
var tid = $(this).data("cb");
$(".cb" + tid).each(function () {
$(".cb" + tid ).each(function(){
$(this).prop("checked", false);
});
})
});
$(".sorted").dataTable(
$.extend(true, {}, dataTablesDefaults, {
[% FOREACH codes_loo IN codes_loop %]
$("#[% codes_loo.code | html %]table").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
paginate: false,
})
);
});
[% END %]
});
</script>
[% END %]

View File

@ -253,13 +253,11 @@
}
$(document).ready(function () {
var crtable = $("#table_cash_registers").DataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
order: [[1, "asc"]],
paginationType: "full",
})
);
var crtable = $("#table_cash_registers").kohaTable({
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
order: [[1, "asc"]],
paginationType: "full",
});
$("#branch_filter").on("change", function () {
// Table must be filtered by the <option>'s text, not its value

View File

@ -241,21 +241,19 @@
$(document).ready(function () {
var txtActivefilter = _("Filter system credit types");
var txtInactivefilter = _("Show all credit types");
var table_credit_types = $("#table_credit_types").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], orderable: false, visible: false },
],
order: [
[0, "asc"],
[2, "asc"],
],
dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
pageLength: 20,
pagingType: "full_numbers",
})
);
var table_credit_types = $("#table_credit_types").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], orderable: false, visible: false },
],
order: [
[0, "asc"],
[2, "asc"],
],
dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
pageLength: 20,
pagingType: "full_numbers",
});
$("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>");
$("#filter_system").click(function (e) {
e.preventDefault();

View File

@ -257,21 +257,19 @@
$(document).ready(function () {
var txtActivefilter = _("Filter system debit types");
var txtInactivefilter = _("Show all debit types");
var table_debit_types = $("#table_debit_types").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], orderable: false, visible: false },
],
order: [
[0, "asc"],
[2, "asc"],
],
dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
pageLength: 20,
pagingType: "full_numbers",
})
);
var table_debit_types = $("#table_debit_types").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], orderable: false, visible: false },
],
order: [
[0, "asc"],
[2, "asc"],
],
dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
pageLength: 20,
pagingType: "full_numbers",
});
$("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>");
$("#filter_system").click(function (e) {
e.preventDefault();

View File

@ -108,12 +108,10 @@
}
}
$(document).ready(function () {
$("#kohafields").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
paging: false,
})
);
$("#kohafields").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
paging: false,
});
$(".addfld").on("click", function (e) {
e.preventDefault();

View File

@ -198,14 +198,12 @@
$(document).ready(function() {
$(".dialog").hide();
var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
"paginate": false,
'autoWidth': false,
}));
var table = $("#localization").kohaTable({
dom: "t",
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
paginate: false,
autoWidth: false,
});
var languages_select = $('<select name="lang" id="lang"></select>');
[% FOR language IN languages %]

View File

@ -393,7 +393,7 @@
});
}
$('#marc-overlay-rules').dataTable($.extend(true, {}, dataTablesDefaults, {
$('#marc-overlay-rules').kohaTable({
"columns": [
{"searchable": false, "orderable": false},
{"orderDataType": "dom-input"},
@ -408,7 +408,7 @@
{"searchable": false, "orderable": false}
],
"pagingType": "simple"
}));
});
var overlay_rules_presets = {};
overlay_rules_presets["protect"] = {

View File

@ -325,12 +325,10 @@
[% Asset.js("js/admin-menu.js") | $raw %]
<script>
$(document).ready(function () {
$("#table_marctagstructure").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
})
);
$("#table_marctagstructure").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
});
$("#select_display").on("change", function () {
var checked = $(this).prop("checked") ? 1 : 0;
Cookies.set("marctagstructure_selectdisplay", checked, { sameSite: "Lax" });

View File

@ -212,12 +212,10 @@
});
[% ELSE %]
$(document).ready(function() {
$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
"pagingType": "full",
}));
$("#serverst").kohaTable({
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
pagingType: "full",
});
$(".delete").on("click",function(e){
var servername = $(this).data("servername");
let formid = $(this).data("formid");

View File

@ -72,12 +72,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#od_info").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
})
);
$("#od_info").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
});
});
</script>
[% END %]

View File

@ -495,13 +495,13 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
[% IF ( loop ) %]$("#sysprefst").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": '<"top pager"ilf>t',
"columnDefs": [
{ "targets": [ -1, -2, -3 ], "orderable": false }
],
"paginate": false
}));[% END %]
[% IF ( loop ) %]
$("#sysprefst").kohaTable({
dom: '<"top pager"ilf>t',
columnDefs: [{ targets: [-1, -2, -3], orderable: false }],
paginate: false,
});
[% END %]
});
</script>
[% END %]

View File

@ -318,12 +318,10 @@
}
[% ELSE %]
$(document).ready(function() {
$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [-1], "orderable": false, "searchable": false },
],
"pagingType": "full"
}));
$("#serverst").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
});
$(".delete").on("click",function(e){
var servername = $(this).data("servername");
let formid = $(this).data("formid");

View File

@ -2081,13 +2081,13 @@
[% END %]
[% IF suggestions.count %]
$(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ "anti-the" ] }
$("#suggestions").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
"pagingType": "full"
}));
pagingType: "full",
});
[% END %]
[% IF ( reviews ) %]

View File

@ -222,13 +222,11 @@
$(document).ready(function () {
// We show table ordered by descending dates by default
// (so that the more recent query is shown first)
$(".historyt").dataTable(
$.extend(true, {}, dataTablesDefaults, {
order: [[1, "desc"]],
columnDefs: [{ targets: [0], orderable: false, searchable: false }],
pagingType: "full_numbers",
})
);
$(".historyt").kohaTable({
order: [[1, "desc"]],
columnDefs: [{ targets: [0], orderable: false, searchable: false }],
pagingType: "full_numbers",
});
// DataTables removes hidden rows from the DOM, so we can't expect a
// "regular" submit to work and we need to build another form containing
@ -237,7 +235,7 @@
e.preventDefault();
var form = $(this);
var table = form.find("table").dataTable();
var table = form.find("table").kohaTable();
var new_form = $("<form>").attr("action", form.attr("action")).attr("method", form.attr("method"));
form.find('input[type="hidden"]')
@ -275,7 +273,7 @@
$(".action_delete").click(function (e) {
e.preventDefault();
var form = $(this).parents("form").first();
var table = form.find("table").dataTable();
var table = form.find("table").kohaTable();
var ids = $("input:checkbox:checked", table);
if ($(ids).length < 1) {
return false;

View File

@ -265,14 +265,12 @@
[% Asset.js("js/z3950_search.js") | $raw %]
<script>
$(document).ready(function () {
$("#resultst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
order: [[1, "asc"]],
paginate: false,
})
);
$("#resultst").kohaTable({
dom: "t",
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
order: [[1, "asc"]],
paginate: false,
});
InitLastAction();
});
</script>

View File

@ -574,22 +574,15 @@
if( link.length > 0 ) link[0].focus();
});
requested_datatable = $("#article-requests-requested-table").DataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [0, -1], "orderable": false, "searchable": false },
],
}));
pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [0, -1], "orderable": false, "searchable": false },
],
}));
processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [0, -1], "orderable": false, "searchable": false },
],
}));
requested_datatable = $("#article-requests-requested-table").kohaTable({
columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
});
pending_datatable = $("#article-requests-pending-table").kohaTable({
columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
});
processing_datatable = $("#article-requests-processing-table").kohaTable({
columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
});
active_datatable = requested_datatable;
activateBatchActions( active_tab );
});

View File

@ -120,16 +120,14 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#notestable").dataTable(
$.extend(true, {}, dataTablesDefaults, {
order: [[1, "asc"]],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
})
);
$("#notestable").kohaTable({
order: [[1, "asc"]],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
});
$(".SelectAll").on("click", function () {
$("input[name='issue_ids'][type='checkbox']").prop("checked", true);

View File

@ -359,15 +359,15 @@
} else if ($('#checkoutrenew').length) {
$('#checkoutrenew').focus();
}
$("#checkout_infos").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"order": [],
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ "anti-the" ] }
$("#checkout_infos").kohaTable({
dom: "t",
order: [],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
"paginate": false
}));
paginate: false,
});
});
// On-site batch checkout
function toggle_onsite_checkout(){

View File

@ -80,7 +80,7 @@
<script>
$(document).ready(function () {
if ($("#pending_onsite_checkout").length) {
$("#pending_onsite_checkout").dataTable($.extend(true, {}, dataTablesDefaults));
$("#pending_onsite_checkout").kohaTable();
}
});
</script>

View File

@ -1706,12 +1706,15 @@
});
});
$('#items-bundle-contents-table').dataTable($.extend(true, {}, dataTablesDefaults, {
"searching": false,
"paginate": false,
"info": false,
"order": [[ 1, 'asc' ], [ 0, 'asc' ]]
}));
$("#items-bundle-contents-table").kohaTable({
searching: false,
paginate: false,
info: false,
order: [
[1, "asc"],
[0, "asc"],
],
});
[% IF ( !(Koha.Preference('TransfersBlockCirc')) && Koha.Preference('AutomaticConfirmTransfer') ) %]
$("#wrong-transfer-modal").on('hidden.bs.modal',function(){

View File

@ -99,14 +99,14 @@
<script>
$(document).ready(function() {
[% FOREACH library IN libraries %]
$("#transferst[% library.branchcode | html %]").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
{ "type": "anti-the", "targets": [ "anti-the" ] }
],
"dom": 't',
"paginate": false
}));
$("#transferst[% library.branchcode | html %]").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ type: "anti-the", targets: ["anti-the"] },
],
dom: "t",
paginate: false,
});
[% END %]
});
</script>

View File

@ -114,14 +114,14 @@
<script>
$(document).ready(function() {
[% FOREACH branchesloo IN branchesloop %]
$("#transferst[% branchesloo.branchcode | html %]").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
{ "type": "anti-the", "targets": [ "anti-the" ] }
],
"dom": 't',
"paginate": false
}));
$("#transferst[% branchesloo.branchcode | html %]").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ type: "anti-the", targets: ["anti-the"] },
],
dom: "t",
paginate: false,
});
[% END %]
});
</script>

View File

@ -93,13 +93,11 @@
[% Asset.js("js/tools-menu.js") | $raw %]
<script>
$(document).ready(function () {
eTable = $("#enrollments-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
})
);
eTable = $("#enrollments-table").kohaTable({
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
});
});
</script>
[% END %]

View File

@ -148,21 +148,17 @@
[% Asset.js("js/tools-menu.js") | $raw %]
<script>
$(document).ready(function () {
tTable = $("#club-templates-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
})
);
tTable = $("#club-templates-table").kohaTable({
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
});
cTable = $("#clubs-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
})
);
cTable = $("#clubs-table").kohaTable({
pagingType: "full",
dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
});
$("body").on("click", ".delete_club", function (e) {
e.preventDefault();

View File

@ -59,12 +59,12 @@
</table>
[% END %]
<script>
$("#table_clubnoenrollmemnts, #table_clubenrollments").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ 'sortable': false, 'targets': [ 'NoSort' ] }
],
paginate: true
}));
let dt_params = {
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
paginate: true,
};
$("#table_clubnoenrollmemnts").kohaTable(dt_params);
$("#table_clubenrollments").kohaTable(dt_params);
[% IF CAN_user_clubs_enroll %]
function loadEnrollmentForm( id, enrollent_id = 0 ) {

View File

@ -345,15 +345,15 @@
[% ELSE %]
$("#description").hide();
[% END %]
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
"autoWidth": false,
"columnDefs": [
{ "type": "anti-the", "targets": [ "anti-the" ] },
{ "targets": [ -1, -2 ], "orderable": false, "searchable": false },
$("#batcht").kohaTable({
autoWidth: false,
columnDefs: [
{ type: "anti-the", targets: ["anti-the"] },
{ targets: [-1, -2], orderable: false, searchable: false },
],
"order": [[ 0, "asc" ]],
"pagingType": "full"
}));
order: [[0, "asc"]],
pagingType: "full",
});
$("#additems").click(function(){
Add();
return false;

View File

@ -216,13 +216,11 @@
$(".delete").on("click", function(){
return confirmDelete( _("Are you sure you want to delete this?") );
});
$("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, {
"pagingType": "full",
"order": [[ 1, "asc" ]],
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
]
}));
$("#labels-table").kohaTable({
pagingType: "full",
order: [[1, "asc"]],
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
});
});
</script>
[% END %]

View File

@ -94,7 +94,7 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#subscriptions").dataTable($.extend(true, {}, dataTablesDefaults, {}));
$("#subscriptions").kohaTable();
$(".unsubscribe").submit(function () {
var patron = $(this).data("patron");
var title = $(this).data("title");

View File

@ -71,16 +71,16 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#pending_updates table").DataTable(
$.extend(true, {}, dataTablesDefaults, {
paging: false,
info: true,
searching: true,
order: [[2, "asc"]],
columnDefs: [{ targets: -1, orderable: false }],
})
);
$(document).ready(function() {
$('#pending_updates table').kohaTable({
paging: false,
info: true,
searching: true,
order: [[2, "asc"]],
columnDefs: [
{ targets: -1, orderable: false }
],
));
});
</script>
[% END %]

View File

@ -182,12 +182,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#noticestable").dataTable(
$.extend(true, {}, dataTablesDefaults, {
order: [[3, "desc"]],
pagingType: "full",
})
);
$("#noticestable").kohaTable({
order: [[3, "desc"]],
pagingType: "full",
});
$("#noticestable").on("click", ".notice-title", function (e) {
e.preventDefault();

View File

@ -135,14 +135,12 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#suggestions").dataTable(
$.extend(true, {}, dataTablesDefaults, {
paginate: false,
searching: false,
info: false,
dom: "t",
})
);
$("#suggestions").kohaTable({
paginate: false,
searching: false,
info: false,
dom: "t",
});
});
</script>
[% END %]

View File

@ -104,12 +104,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#statistics").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
paginate: false,
})
);
$("#statistics").kohaTable({
dom: "t",
paginate: false,
});
});
</script>
[% END %]

View File

@ -65,14 +65,12 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#catst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
order: [[2, "asc"]],
columnDefs: [{ targets: [0], orderable: false, searchable: false }],
paginate: false,
})
);
$("#catst").kohaTable({
dom: "t",
order: [[2, "asc"]],
columnDefs: [{ targets: [0], orderable: false, searchable: false }],
paginate: false,
});
$("#updatechildf").validate({
rules: {
catcode: {

View File

@ -148,13 +148,11 @@
let selectedPatronLists = new Array();
$('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
"autoWidth": false,
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }
],
"pagingType": "full"
} ));
$("#patron-lists-table").kohaTable({
autoWidth: false,
columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }],
pagingType: "full",
});
$(".delete_patron").on("click", function(){
$(".dropdown").removeClass("open");
var list = $(this).data("list-name");

View File

@ -111,12 +111,12 @@
</div>
[% END %]
<script>
$("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] }
],
"sPaginationType": "full"
}));
let dt_params = {
columnDefs: [{ sortable: false, bSearchable: false, targets: ["NoSort"] }],
sPaginationType: "full",
};
$("#table_listnopatron").kohaTable(dt_params);
$("#table_inlists").kohaTable(dt_params);
[% IF CAN_user_tools_manage_patron_lists %]
function addToList() {

View File

@ -309,16 +309,14 @@
[% ELSE %]
$("#description").hide();
[% END %]
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -2, -1 ], "orderable": false, "searchable": false }
],
"order": [[ 0, "asc" ]],
"pagingType": "full",
"lengthMenu": [aLengthMenu, aLengthMenuLabel],
"pageLength": patronsPerPage,
"autoWidth": false
}));
$("#batcht").kohaTable({
columnDefs: [{ targets: [-2, -1], orderable: false, searchable: false }],
order: [[0, "asc"]],
pagingType: "full",
lengthMenu: [aLengthMenu, aLengthMenuLabel],
pageLength: patronsPerPage,
autoWidth: false,
});
$("#additems").click(function(){
return Add();
});

View File

@ -336,7 +336,7 @@
$(document).ready(function() {
const sale_table = document.getElementById('sale');
const saleDataTable = $("#sale").DataTable($.extend(true, {}, dataTablesDefaults, {
const saleDataTable = $("#sale").kohaTable({
"paginate": false,
"searching": false,
"info": false,
@ -385,7 +385,7 @@
$('#paid').val(total_price).trigger('change');
},
"autoWidth": false
}));
});
$("#sale").on("click", "button.drop", function(){
saleDataTable.row($(this).parents('tr')).remove().draw(false);

View File

@ -439,7 +439,7 @@
[% Asset.js("js/modal_printer.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script>
var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
var sales_table = $("#sales").kohaTable({
orderFixed: [ 0, 'asc'],
ordering: false,
columnDefs: [ {
@ -464,9 +464,9 @@
initComplete: function() {
$("#sales").show();
}
}));
});
var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, {
var past_sales_table = $("#past_sales").kohaTable({
orderFixed: [ 0, 'asc'],
ordering: false,
columnDefs: [ {
@ -486,7 +486,7 @@
},
endRender: null,
}
}));
});
$("#issueRefundModal").on("shown.bs.modal", function(e){
var button = $(e.relatedTarget);

View File

@ -215,10 +215,10 @@
$("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])');
$("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])');
var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
"searching": false,
"paginationType": "full"
}));
var registers_table = $("#registers").kohaTable({
searching: false,
paginationType: "full",
});
$("#confirmCashupModal").on("shown.bs.modal", function(e){
var button = $(e.relatedTarget);

View File

@ -152,16 +152,14 @@
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function () {
$("#recalls-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, targets: ["nosort"] },
{ type: "title-string", targets: ["title-string"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
})
);
$("#recalls-table").kohaTable({
columnDefs: [
{ orderable: false, targets: ["nosort"] },
{ type: "title-string", targets: ["title-string"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
});
$(".cancelreturn").click(function () {
return confirmDelete(_("Are you sure you want to remove this recall and return the item to its home library?"));

View File

@ -157,13 +157,11 @@
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function () {
$("#recallswaiting-table, #recallsover-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
autoWidth: false,
columnDefs: [{ orderable: false, targets: ["nosort"] }],
pagingType: "full_numbers",
})
);
$("#recallswaiting-table, #recallsover-table").kohaTable({
autoWidth: false,
columnDefs: [{ orderable: false, targets: ["nosort"] }],
pagingType: "full_numbers",
});
$(".revert_recall").click(function (e) {
return confirmDelete(_("Are you sure you want to revert this recall's status from Waiting?"));

View File

@ -204,12 +204,10 @@
<script>
actTotal = "";
$(document).ready(function () {
$("#tbl_cash_register_stats").dataTable(
$.extend(true, {}, dataTablesDefaults, {
pageLength: 50,
pagingType: "full_numbers",
})
);
$("#tbl_cash_register_stats").kohaTable({
pageLength: 50,
pagingType: "full_numbers",
});
$("#branch").on("change", function () {
var selectedBranch = $("#branch").children("option:selected").val();

View File

@ -2539,7 +2539,7 @@
$(".mana_search_status").hide();
$("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
$("#mana-loading").hide();
$("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
$("#mana_results_datatable").kohaTable({
"pagingType": "full",
"autoWidth": false,
"columnDefs": [
@ -2549,7 +2549,7 @@
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ 'anti-the'] }
]
}));
});
$(".showbutton").on("click", function(e){
e.preventDefault();

View File

@ -102,12 +102,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#itemtypest").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
paginate: false,
})
);
$("#itemtypest").kohaTable({
dom: "t",
paginate: false,
});
});
</script>
[% END %]

View File

@ -147,11 +147,9 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#resulttable").dataTable(
$.extend(true, {}, dataTablesDefaults, {
paginate: false,
})
);
$("#resulttable").kohaTable({
paginate: false,
});
});
</script>
[% END %]

View File

@ -1508,11 +1508,10 @@
});
[% END %]
var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
"paginate": false,
"dom": '<"top pager"ilf>t',
}));
var my_table = $("#requestspecific").kohaTable({
paginate: false,
dom: '<"top pager"ilf>t',
});
$("#club-request-form").on("submit", function() {
let $t = $(this);

View File

@ -217,16 +217,14 @@
<script>
var sTable;
$(document).ready(function () {
sTable = $("#claimst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
columnDefs: [
{ targets: [0], orderable: false, searchable: false },
{ type: "anti-the", targets: ["anti-the"] },
],
paginate: false,
})
);
sTable = $("#claimst").kohaTable({
dom: "t",
columnDefs: [
{ targets: [0], orderable: false, searchable: false },
{ type: "anti-the", targets: ["anti-the"] },
],
paginate: false,
});
$("#supplierid").change(function () {
$("#claims").submit();
});

View File

@ -359,17 +359,15 @@
if( $("#subscription_years .tab-pane.active").length < 1 ){
$("#subscription_years a:first").tab("show");
}
$(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ 0,-1 ], "orderable": false, "searchable": false }
],
"order": [[0, 'desc']],
"dom": 't',
"autoWidth": false,
"paginate": false,
"info": false,
"searching": false,
} ));
$(".subscription-year-table").kohaTable({
columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
order: [[0, "desc"]],
dom: "t",
autoWidth: false,
paginate: false,
info: false,
searching: false,
});
$(".CheckAll").on("click", function(e){
e.preventDefault();

View File

@ -334,32 +334,32 @@
}
$(document).ready(function() {
var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
"pagingType": "full",
"order": [[ 2, "asc" ]],
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ 'anti-the'] }
]
}));
var osrlt = $("#opened_panel table").kohaTable({
pagingType: "full",
order: [[2, "asc"]],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
});
var csrlt = $("#closed_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
var csrlt = $("#closed_panel table").kohaTable({
// FIXME sort function of additional_fields!
"order": [[ 2, "asc" ]],
"pagingType": "full",
"columnDefs": [
{ "orderable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ 'anti-the'] }
]
}));
order: [[2, "asc"]],
pagingType: "full",
columnDefs: [
{ orderable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
});
var manarlt = $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
"pagingType": "full",
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ 'anti-the'] }
]
}));
var manarlt = $("#mana_results_datatable").kohaTable({
pagingType: "full",
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
});
$("#reopensub").click(function(){
return confirm(_("Are you sure you want to reopen this subscription?"));

View File

@ -390,12 +390,10 @@
}
$(document).ready(function(){
$("#numberpatternst").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
],
"pagingType": "full"
}));
$("#numberpatternst").kohaTable({
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
pagingType: "full",
});
$(".delete_pattern").on("click",function(){
return confirmDelete();

View File

@ -161,13 +161,11 @@
event.preventDefault();
}
});
$("#itemst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
order: [[0, "asc"]],
pagingType: "full",
})
);
$("#itemst").kohaTable({
columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
order: [[0, "asc"]],
pagingType: "full",
});
});
</script>
[% END %]

View File

@ -67,12 +67,10 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#files").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: [-1], orderSequence: ["desc", "asc"], searchable: false }],
paginate: false,
})
);
$("#files").kohaTable({
columnDefs: [{ targets: [-1], orderSequence: ["desc", "asc"], searchable: false }],
paginate: false,
});
});
</script>
[% END %]

View File

@ -604,16 +604,14 @@
});
$(document).ready(function () {
var table = $("#table_additional_contents").DataTable(
$.extend(true, {}, dataTablesDefaults, {
order: [[4, "desc"]],
columnDefs: [
{ sortable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
})
);
var table = $("#table_additional_contents").kohaTable({
order: [[4, "desc"]],
columnDefs: [
{ sortable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
});
$("#del_form").on("click", ".delete_news", function (e) {
e.preventDefault();

View File

@ -346,25 +346,25 @@
});
[% END %]
$("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ 0 ], "orderable": false, "searchable": false },
{ "targets": [ 3, 4 ], "type": "num-html" }
],
"dom": 't',
"order": [],
"paginate": false
}));
$("#biblios").kohaTable({
columnDefs: [
{ targets: [0], orderable: false, searchable: false },
{ targets: [3, 4], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
});
$("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ 0 ], "orderable": false, "searchable": false },
{ "targets": [ 3 ], "type": "num-html" }
],
"dom": 't',
"order": [],
"paginate": false
}));
$("#authorities").kohaTable({
columnDefs: [
{ targets: [0], orderable: false, searchable: false },
{ targets: [3], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
});
$("#selectrecords").on("submit",function(){
var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size();

View File

@ -267,29 +267,25 @@
$("#selectall").click();
$("#checkouts").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
})
);
$("#checkouts").kohaTable({
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
});
$("#checkouts_result").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
})
);
$("#checkouts_result").kohaTable({
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
dom: "t",
order: [],
paginate: false,
});
$("#extend_due_dates_form").on("submit", function (e) {
var new_hard_due_date = $("#new_hard_due_date").val();

View File

@ -353,25 +353,25 @@
$("#selectall").click();
$("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [0, 3], "orderable": false, "searchable": false },
{ "targets": [1], "type": "num-html" }
$("#biblios").kohaTable({
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
"dom": 't',
"order": [],
"paginate": false
}));
dom: "t",
order: [],
paginate: false,
});
$("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [0, 3], "orderable": false, "searchable": false },
{ "targets": [1], "type": "num-html" }
$("#authorities").kohaTable({
columnDefs: [
{ targets: [0, 3], orderable: false, searchable: false },
{ targets: [1], type: "num-html" },
],
"dom": 't',
"order": [],
"paginate": false
}));
dom: "t",
order: [],
paginate: false,
});
$("#mainformsubmit").click(function() {
if ($("input[type=checkbox][name='record_id']:checked").length == 0) {

View File

@ -608,20 +608,24 @@
var first_td = $(this).find('td').first();
first_td.html(weekdays[first_td.html()]);
});
$("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"paginate": false
}));
var tables = $("#holidayexceptions, #holidaysyearlyrepeatable, #holidaysunique").DataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"paginate": false,
"createdRow": function( row, data, dataIndex ) {
$("#holidayweeklyrepeatable").kohaTable({
dom: "t",
paginate: false,
});
let dt_params = {
dom: "t",
paginate: false,
createdRow: function (row, data, dataIndex) {
var holiday = $(row).data("date");
if( holiday < datestring ){
if (holiday < datestring) {
$(row).addClass("date_past");
}
}
}));
},
};
$("#holidayexceptions").kohaTable(dt_params);
$("#holidaysyearlyrepeatable").kohaTable(dt_params);
$("#holidaysunique").kohaTable(dt_params);
$(".show_past").on("change", function(){
tables.draw();

View File

@ -470,7 +470,7 @@
});
[% IF import_batch_id %]
$("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
$("#records-table").kohaTable({
"autoWidth": false,
"searching": false,
"processing": true,
@ -596,7 +596,7 @@
);
}
},
}));
});
$("#revert_batch_form").on("submit", function() {
return confirm(_("Are you sure you want to undo the import of this batch into the catalog?"));
});

View File

@ -188,13 +188,11 @@
if ($("#rulestabs .tab-pane.active").length < 1) {
$("#rulestabs a:first").tab("show");
}
$(".overduerulest").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ targets: ["NoSort"], orderable: false, searchable: false }],
dom: '<"top pager"f>rt<"clear">',
paginate: false,
})
);
$(".overduerulest").kohaTable({
columnDefs: [{ targets: ["NoSort"], orderable: false, searchable: false }],
dom: '<"top pager"f>rt<"clear">',
paginate: false,
});
$("#overduerulesf").on("submit", function (e) {
$(".overduerulest").DataTable().search("").draw();

View File

@ -142,16 +142,14 @@
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function () {
$("#problemreportstable").dataTable(
$.extend(true, {}, dataTablesDefaults, {
order: [[1, "asc"]],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
})
);
$("#problemreportstable").kohaTable({
order: [[1, "asc"]],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
});
$(".SelectAll").on("click", function () {
$("input[name='report_ids'][type='checkbox']").prop("checked", true);

View File

@ -242,7 +242,7 @@
$("#quotes_editor").show();
$("#save_quotes").on("click", yuiGetData);
let table = $("#quotes_editor").dataTable({
let table = $("#quotes_editor").kohaTable({
autoWidth: false,
paging: true,
ordering: false,

View File

@ -663,7 +663,7 @@
'vs.lastmodified',
];
var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
var dtListResults = $("#listresultst").kohaTable({
order: [[ 5, "asc" ]],
serverSide: true,
ajax: {
@ -701,7 +701,7 @@
"searching": false,
"processing": true,
"orderCellsTop": true
}));
});
_dt_add_delay_filters(dtListResults.api(), $("#listresultst"));
/* Select correct tab based on URL parameter */

View File

@ -1,17 +1,15 @@
/* global dataTablesDefaults __ template_path */
/* global __ template_path */
$(document).ready(function () {
$("#Aform").preventDoubleFormSubmit();
$("#files").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
order: [],
})
);
$("#files").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full",
order: [],
});
checkOrderBudgets();
var all_budget_id = $("#all_budget_id");

View File

@ -3,16 +3,14 @@
var importing = false;
$(document).ready(function () {
$("#authtypes").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], type: "natural" },
],
ordering: true,
pagingType: "full",
})
);
$("#authtypes").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], type: "natural" },
],
ordering: true,
pagingType: "full",
});
$("body").css("cursor", "auto");
$(".import_export_options").hide();

View File

@ -4,16 +4,14 @@
var importing = false;
$(document).ready(function () {
$("#table_biblio_frameworks").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], type: "natural" },
],
ordering: true,
pagingType: "full",
})
);
$("#table_biblio_frameworks").kohaTable({
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
{ targets: [0, 1], type: "natural" },
],
ordering: true,
pagingType: "full",
});
$("body").css("cursor", "auto");
$(".import_export_options").hide();

View File

@ -1,4 +1,4 @@
/* global __ dataTablesDefaults showMore showLess delSelRecords addSelToShelf sendBasket printBasket delBasket openBiblio selRecord */
/* global __ showMore showLess delSelRecords addSelToShelf sendBasket printBasket delBasket openBiblio selRecord */
function placeHold() {
var checkedItems = $("input:checkbox:checked");
@ -94,18 +94,16 @@ $(document).ready(function () {
$(".hold").text(__("Place hold"));
$("#downloadcartc").empty();
$("#itemst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
{ type: "callnumbers", targets: ["callnumbers"] },
],
order: [[1, "asc"]],
paging: false,
})
);
$("#itemst").kohaTable({
dom: "t",
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
{ type: "callnumbers", targets: ["callnumbers"] },
],
order: [[1, "asc"]],
paging: false,
});
$(".showdetails").on("click", function (e) {
e.preventDefault();

View File

@ -1380,7 +1380,7 @@ $(document).ready(function () {
}
function loadReturnClaimsTable() {
if (!returnClaimsTable) {
returnClaimsTable = $("#return-claims-table").dataTable({
returnClaimsTable = $("#return-claims-table").kohaTable({
autoWidth: false,
dom: "rt",
order: [],

View File

@ -1332,22 +1332,29 @@ function update_search_description(
};
}
if (options.ajax) {
options.ajax = Object.assign(
{},
options.ajax,
_dt_default_ajax({ default_filters, options })
);
options.serverSide = true;
options.processing = true;
options.pagingType = "full_numbers";
}
settings = $.extend(
true,
{},
dataTablesDefaults,
{
paging: true,
serverSide: true,
searching: true,
pagingType: "full_numbers",
processing: true,
language: {
emptyTable: options.emptyTable
? options.emptyTable
: __("No data available in table"),
},
ajax: _dt_default_ajax({ default_filters, options }),
},
options
);

View File

@ -1,4 +1,4 @@
/* global __ dataTablesDefaults */
/* global __ */
function clean_line(line) {
$(line).find('input[type="text"]').val("");
@ -52,16 +52,13 @@ function tableInit(oldtabid, newtabid) {
oldTableId.DataTable().destroy();
}
var newTableId = $("#" + newtabid + "_table");
newTableId.DataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
],
paging: false,
autoWidth: false,
})
);
$("#" + newtabid + "_table").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
],
paging: false,
autoWidth: false,
});
}
$(document).ready(function () {

View File

@ -105,7 +105,7 @@ function display_pickup_location(state) {
};
})(jQuery);
/* global __ dataTablesDefaults borrowernumber SuspendHoldsIntranet */
/* global __ borrowernumber SuspendHoldsIntranet */
$(document).ready(function () {
function suspend_hold(hold_id, end_date) {
var params;

View File

@ -1,4 +1,4 @@
/* global dataTablesDefaults tagsubfield selectBsTabByHash */
/* global tagsubfield selectBsTabByHash */
$(document).ready(function () {
if (tagsubfield && tagsubfield == "@") {
$("#subfieldtabs a[href='#AT_panel']").tab("show");
@ -29,13 +29,11 @@ $(document).ready(function () {
$("input[id^='hidden-']").each(function () {
populateHiddenCheckboxes($(this).attr("id").split("-")[1]);
});
$("#table_marcsubfieldstructure").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
order: [],
paginate: false,
})
);
$("#table_marcsubfieldstructure").kohaTable({
columnDefs: [{ sortable: false, targets: ["NoSort"] }],
order: [],
paginate: false,
});
selectBsTabByHash("subfieldtabs");
});

View File

@ -1,4 +1,5 @@
/* global KOHA CodeMirror to_highlight search_jumped humanMsg dataTablesDefaults themelang */
/* keep tidy */
/* global KOHA CodeMirror to_highlight search_jumped humanMsg themelang */
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
KOHA.Preferences = {
@ -207,14 +208,12 @@ function addConsentDeleteHandler() {
});
}
$("table.preferences").dataTable(
$.extend(true, {}, dataTablesDefaults, {
dom: "t",
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
paging: false,
fixedHeader: false,
})
);
$("table.preferences").kohaTable({
dom: "t",
columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
paging: false,
fixedHeader: false,
});
$(".prefs-tab")
.find("input.preference, textarea.preference")

View File

@ -74,16 +74,14 @@ var success_test_call = function () {
};
$(document).ready(function () {
$("#tagst").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
order: [[2, "desc"]],
pagingType: "full",
})
);
$("#tagst").kohaTable({
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
order: [[2, "desc"]],
pagingType: "full",
});
$(".ajax_buttons").css({ visibility: "visible" });
$("p.check").html(
'<div id="searchheader"><a id="CheckAll" href="/cgi-bin/koha/tags/review.pl"><i class="fa fa-check" aria-hidden="false"><\/i> ' +

View File

@ -127,16 +127,14 @@ $(document).ready(function () {
}
});
$("#recalls-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
columnDefs: [
{ orderable: false, targets: ["nosort"] },
{ type: "title-string", targets: ["title-string"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
})
);
$("#recalls-table").kohaTable({
columnDefs: [
{ orderable: false, targets: ["nosort"] },
{ type: "title-string", targets: ["title-string"] },
{ type: "anti-the", targets: ["anti-the"] },
],
pagingType: "full_numbers",
});
$("#cancel_selected").click(function (e) {
if ($("input[name='recall_ids']:checked").length > 0) {

View File

@ -1,4 +1,4 @@
/* global _ dataTablesDefaults */
/* global _ */
$(document).ready(function () {
$("#barcode").focus();
@ -21,14 +21,12 @@ $(document).ready(function () {
});
if ($("#rotating-collections-table").length > 0) {
$("#rotating-collections-table").dataTable(
$.extend(true, {}, dataTablesDefaults, {
autoWidth: false,
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
],
pagingType: "full",
})
);
$("#rotating-collections-table").kohaTable({
autoWidth: false,
columnDefs: [
{ targets: [-1], orderable: false, searchable: false },
],
pagingType: "full",
});
}
});

View File

@ -556,25 +556,19 @@ function mana_search() {
$("#mana_search_result_label").text(
__("Results from Mana Knowledge Base")
);
$("#mana_results_datatable").dataTable(
$.extend(true, {}, dataTablesDefaults, {
pagingType: "full",
order: [
[4, "desc"],
[5, "desc"],
],
autoWidth: false,
columnDefs: [{ width: "35%", targets: 1 }],
columnDefs: [
{
orderable: false,
searchable: false,
targets: ["NoSort"],
},
{ type: "anti-the", targets: ["anti-the"] },
],
})
);
$("#mana_results_datatable").kohaTable({
pagingType: "full",
order: [
[4, "desc"],
[5, "desc"],
],
autoWidth: false,
columnDefs: [{ width: "35%", targets: 1 }],
columnDefs: [
{ orderable: false, searchable: false, targets: ["NoSort"] },
{ type: "anti-the", targets: ["anti-the"] },
],
});
if (
$("#mana_results_datatable").length &&
$("td.dataTables_empty").length == 0

View File

@ -89,97 +89,89 @@ export default {
$.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter(
search => search.name != "apply_filter"
);
$("#" + table_id).dataTable({
...dataTablesDefaults,
...{
data: resources,
embed: ["package.name"],
ordering: false,
dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>',
lengthMenu: [
[10, 20, 50, 100],
[10, 20, 50, 100],
],
autoWidth: false,
columns: [
{
title: __("Name"),
data: "package.name",
searchable: false,
orderable: false,
render: function (data, type, row, meta) {
// Rendering done in drawCallback
return "";
},
width: "100%",
$("#" + table_id).kohaTable({
data: resources,
embed: ["package.name"],
ordering: false,
dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>',
lengthMenu: [
[10, 20, 50, 100],
[10, 20, 50, 100],
],
autoWidth: false,
columns: [
{
title: __("Name"),
data: "package.name",
searchable: false,
orderable: false,
render: function (data, type, row, meta) {
// Rendering done in drawCallback
return "";
},
],
drawCallback: function (settings) {
var api = new $.fn.dataTable.Api(settings);
width: "100%",
},
],
drawCallback: function (settings) {
var api = new $.fn.dataTable.Api(settings);
if (!api.rows({ search: "applied" }).count()) return;
if (!api.rows({ search: "applied" }).count()) return;
$.each(
$(this).find("tbody tr td:first-child"),
function (index, e) {
let tr = $(this).parent();
let row = api.row(tr).data();
if (!row) return; // Happen if the table is empty
let { href } = router.resolve({
name: "EHoldingsEBSCOResourcesShow",
params: { resource_id: row.resource_id },
});
let n = createVNode(
"a",
{
role: "button",
href,
onClick: e => {
e.preventDefault();
show_resource(row.resource_id);
},
$.each(
$(this).find("tbody tr td:first-child"),
function (index, e) {
let tr = $(this).parent();
let row = api.row(tr).data();
if (!row) return; // Happen if the table is empty
let { href } = router.resolve({
name: "EHoldingsEBSCOResourcesShow",
params: { resource_id: row.resource_id },
});
let n = createVNode(
"a",
{
role: "button",
href,
onClick: e => {
e.preventDefault();
show_resource(row.resource_id);
},
`${row.package.name}`
);
if (row.is_selected) {
n = createVNode("span", {}, [
n,
" ",
createVNode("i", {
class: "fa fa-check-square",
style: {
color: "green",
float: "right",
},
title: __("Is selected"),
}),
]);
}
render(n, e);
},
`${row.package.name}`
);
if (row.is_selected) {
n = createVNode("span", {}, [
n,
" ",
createVNode("i", {
class: "fa fa-check-square",
style: {
color: "green",
float: "right",
},
title: __("Is selected"),
}),
]);
}
);
},
initComplete: function () {
$.fn.dataTable.ext.search.push(
function apply_filter(
settings,
data,
dataIndex,
row
) {
return (
row.package.name.match(
new RegExp(filters.package_name, "i")
) &&
(filters.selection_type == 0 ||
(filters.selection_type == 1 &&
row.is_selected) ||
(filters.selection_type == 2 &&
!row.is_selected))
);
}
);
},
render(n, e);
}
);
},
initComplete: function () {
$.fn.dataTable.ext.search.push(
function apply_filter(settings, data, dataIndex, row) {
return (
row.package.name.match(
new RegExp(filters.package_name, "i")
) &&
(filters.selection_type == 0 ||
(filters.selection_type == 1 &&
row.is_selected) ||
(filters.selection_type == 2 &&
!row.is_selected))
);
}
);
},
});
},

View File

@ -5,36 +5,35 @@
</template>
<script>
import { createVNode, render } from "vue";
import { useDataTable } from "../../composables/datatables";
import { createVNode, render } from "vue"
import { useDataTable } from "../../composables/datatables"
export default {
setup() {
const table_id = "package_list";
useDataTable(table_id);
const table_id = "package_list"
useDataTable(table_id)
return {
table_id,
};
}
},
data() {
return {};
return {}
},
methods: {
show_resource: function (resource_id) {
this.$router.push({
name: "EHoldingsLocalResourcesShow",
params: { resource_id },
});
})
},
build_datatable: function () {
let show_resource = this.show_resource;
let router = this.$router;
let resources = this.resources;
let table_id = this.table_id;
let show_resource = this.show_resource
let router = this.$router
let resources = this.resources
let table_id = this.table_id
$("#" + table_id).dataTable(
$.extend(true, {}, dataTablesDefaults, {
$("#" + table_id).kohaTable({
data: resources,
embed: ["package.name"],
order: [[0, "asc"]],
@ -47,52 +46,52 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
// Rendering done in drawCallback
return "";
return ""
},
width: "100%",
},
],
drawCallback: function (settings) {
var api = new $.fn.dataTable.Api(settings);
var api = new $.fn.dataTable.Api(settings)
$.each(
$(this).find("tbody tr td:first-child"),
function (index, e) {
let tr = $(this).parent();
let row = api.row(tr).data();
if (!row) return; // Happen if the table is empty
let tr = $(this).parent()
let row = api.row(tr).data()
if (!row) return // Happen if the table is empty
let { href } = router.resolve({
name: "EHoldingsLocalResourcesShow",
params: { resource_id: row.resource_id },
});
})
let n = createVNode(
"a",
{
role: "button",
href,
onClick: e => {
e.preventDefault();
show_resource(row.resource_id);
e.preventDefault()
show_resource(row.resource_id)
},
},
`${row.package.name}`
);
render(n, e);
)
render(n, e)
}
);
)
},
})
);
)
},
},
mounted() {
this.build_datatable();
this.build_datatable()
},
props: {
resources: Array,
},
name: "EHoldingsLocalTitlePackagesList",
};
}
</script>
<style scoped>

View File

@ -82,70 +82,62 @@ export default {
let lists = this.logged_in_user_lists;
let table_id = this.table_id;
let import_from_list = this.import_from_list;
$("#" + table_id).dataTable(
$.extend(true, {}, dataTablesDefaults, {
data: lists,
order: [[0, "asc"]],
autoWidth: false,
columns: [
{
title: __("Name"),
data: "shelfname",
searchable: true,
orderable: true,
width: "100%",
render: function (data, type, row, meta) {
return (
row.shelfname +
" (#" +
row.shelfnumber +
")"
);
},
$("#" + table_id).kohaTable({
data: lists,
order: [[0, "asc"]],
autoWidth: false,
columns: [
{
title: __("Name"),
data: "shelfname",
searchable: true,
orderable: true,
width: "100%",
render: function (data, type, row, meta) {
return (
row.shelfname + " (#" + row.shelfnumber + ")"
);
},
{
title: __("Actions"),
data: function (row, type, val, meta) {
return '<div class="actions"></div>';
},
className: "actions noExport",
searchable: false,
orderable: false,
},
],
drawCallback: function (settings) {
var api = new $.fn.dataTable.Api(settings);
$.each(
$(this).find("td .actions"),
function (index, e) {
let tr = $(this).parent().parent();
let list_id = api.row(tr).data().shelfnumber;
let importButton = createVNode(
"a",
{
class: "btn btn-default btn-xs",
role: "button",
onClick: () => {
import_from_list(list_id);
},
},
[
createVNode("i", {
class: "fa fa-download",
"aria-hidden": "true",
}),
__("Import"),
]
);
let n = createVNode("span", {}, [importButton]);
render(n, e);
}
);
},
})
);
{
title: __("Actions"),
data: function (row, type, val, meta) {
return '<div class="actions"></div>';
},
className: "actions noExport",
searchable: false,
orderable: false,
},
],
drawCallback: function (settings) {
var api = new $.fn.dataTable.Api(settings);
$.each($(this).find("td .actions"), function (index, e) {
let tr = $(this).parent().parent();
let list_id = api.row(tr).data().shelfnumber;
let importButton = createVNode(
"a",
{
class: "btn btn-default btn-xs",
role: "button",
onClick: () => {
import_from_list(list_id);
},
},
[
createVNode("i", {
class: "fa fa-download",
"aria-hidden": "true",
}),
__("Import"),
]
);
let n = createVNode("span", {}, [importButton]);
render(n, e);
});
},
});
},
},
mounted() {