From cb85d7a00abcc6d2e804065432ed645a7d99c135 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 30 May 2022 11:35:53 +0200 Subject: [PATCH] Bug 32030: (follow-up) Fix datatable.js order_by The previous change was not working, we need to define a render function to prevent a DT error. "Requested unknown parameter 'me.agreement_id,me.name' for row 0, column 0" Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 4 +--- .../prog/js/vue/components/ERM/AgreementsList.vue | 7 +++++-- .../prog/js/vue/components/ERM/EHoldingsPackagesList.vue | 7 +++++-- .../prog/js/vue/components/ERM/EHoldingsTitlesList.vue | 9 ++++++--- .../prog/js/vue/components/ERM/LicensesList.vue | 7 +++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 4851fa693c..9c5386a394 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -684,9 +684,7 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { order.forEach(function (e,i) { var order_col = e.column; var order_by = options.columns[order_col].data; - if (!Array.isArray(order_by)) { - order_by = order_by.split(':'); - } + order_by = order_by.split(':'); var order_dir = e.dir == 'asc' ? '+' : '-'; Array.prototype.push.apply(orderArray,order_by.map(x => order_dir + (!x.includes('.')?'me.'+x:x))); }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index 28897a1db7..451493f3de 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -118,10 +118,13 @@ export default { "columns": [ { "title": __("Name"), - "data": ["me.agreement_id", "me.name"], + "data": "me.agreement_id:me.name", "searchable": true, "orderable": true, - // Rendering done in drawCallback + "render": function (data, type, row, meta) { + // Rendering done in drawCallback + return ""; + } }, { "title": __("Vendor"), diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesList.vue index a5b4c0048f..1ec680eea1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesList.vue @@ -107,10 +107,13 @@ export default { "columns": [ { "title": __("Name"), - "data": ["me.package_id", "me.name"], + "data": "me.package_id:me.name", "searchable": true, "orderable": true, - // Rendering done in drawCallback + "render": function (data, type, row, meta) { + // Rendering done in drawCallback + return ""; + } }, { "title": __("Vendor"), diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsTitlesList.vue index d3f0238c8f..c651d601ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsTitlesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsTitlesList.vue @@ -84,10 +84,13 @@ export default { "columns": [ { "title": __("Title"), - "data": ["me.title_id", "me.publication_title"], + "data": "me.title_id:me.publication_title", "searchable": true, "orderable": true, - // Rendering done in drawCallback + "render": function (data, type, row, meta) { + // Rendering done in drawCallback + return ""; + } }, { "title": __("Vendor"), @@ -106,7 +109,7 @@ export default { }, { "title": __("Identifier"), - "data": ["print_identifier", "online_identifier"], + "data": "print_identifier:online_identifier", "searchable": true, "orderable": true, "render": function (data, type, row, meta) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue index 4e9c4f64cd..9aed343ee6 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue @@ -69,10 +69,13 @@ export default { "columns": [ { "title": __("Name"), - "data": ["me.license_id", "me.name"], + "data": "me.license_id:me.name", "searchable": true, "orderable": true, - // Rendering done in drawCallback + "render": function (data, type, row, meta) { + // Rendering done in drawCallback + return ""; + } }, { "title": __("Description"), -- 2.39.5