From 16168927fc8e658e175906d0e65695e4a3bd78bf Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sat, 21 Dec 2024 13:19:40 +0100 Subject: [PATCH] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass --- .../ERM/EHoldingsLocalTitlePackagesList.vue | 89 +++++++++---------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue index c96fe78e3fa..b4e8258d726 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue @@ -34,54 +34,53 @@ export default { let table_id = this.table_id $("#" + table_id).kohaTable({ - data: resources, - embed: ["package.name"], - order: [[0, "asc"]], - autoWidth: false, - columns: [ - { - title: __("Name"), - data: "package.name", - searchable: true, - orderable: true, - render: function (data, type, row, meta) { - // Rendering done in drawCallback - return "" - }, - width: "100%", + data: resources, + embed: ["package.name"], + order: [[0, "asc"]], + autoWidth: false, + columns: [ + { + title: __("Name"), + data: "package.name", + searchable: true, + orderable: true, + 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) - $.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: "EHoldingsLocalResourcesShow", - 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: "EHoldingsLocalResourcesShow", + 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}` - ) - render(n, e) - } - ) - }, - }) - ) + }, + `${row.package.name}` + ) + render(n, e) + } + ) + }, + }) }, }, mounted() { -- 2.39.5