From 35262a25f1deb3b3e48da831e495aa260e22340b Mon Sep 17 00:00:00 2001 From: Whinis Date: Tue, 3 Feb 2026 23:00:42 -0500 Subject: [PATCH] Adds buttons to all data tables that allow export via excel and CSV. Need to find a way to allow translations --- .../datatables/datatables_controller.js | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/controllers/elements/datatables/datatables_controller.js b/assets/controllers/elements/datatables/datatables_controller.js index 5a50623d5..51a6b65ab 100644 --- a/assets/controllers/elements/datatables/datatables_controller.js +++ b/assets/controllers/elements/datatables/datatables_controller.js @@ -122,12 +122,22 @@ export default class extends Controller { header: $(window).width() >= 768, //Only enable fixedHeaders on devices with big screen. Fixes scrolling issues on smartphones. headerOffset: $("#navbar").outerHeight() }, - buttons: [{ - "extend": 'colvis', - 'className': 'mr-2 btn-outline-secondary', - 'columns': ':not(.no-colvis)', - "text": "" - }], + buttons: [ + { + "extend": 'colvis', + 'className': 'mr-2 btn-outline-secondary', + 'columns': ':not(.no-colvis)', + "text": "" + }, + { + text: 'CSV', + action: $.fn.initDataTables.exportBtnAction('csv', settings), + }, + { + text: 'Excel', + action: $.fn.initDataTables.exportBtnAction('excel', settings), + } + ], rowCallback: this._rowCallback.bind(this),