From 645e8f426cd7f2a8b556541c426e76e142ebfed8 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Tue, 11 Oct 2022 11:35:07 +0200 Subject: [PATCH] shift datatable child toggle function to api.js --- data/web/js/build/012-api.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/data/web/js/build/012-api.js b/data/web/js/build/012-api.js index b9887940..c657c134 100644 --- a/data/web/js/build/012-api.js +++ b/data/web/js/build/012-api.js @@ -380,4 +380,18 @@ $(document).ready(function() { $('#ConfirmDeleteModal').modal('hide'); }); }); + + // toggle jquery datatables child rows + $('button[data-datatables-expand], a[data-datatables-expand]').on('click', function (e) { + e.preventDefault(); + var tableId = e.target.getAttribute("data-datatables-expand"); + var table = $("#" + tableId).DataTable(); + table.rows(':not(.parent)').nodes().to$().find('td:first-child').trigger('click'); + }); + $('button[data-datatables-collapse], a[data-datatables-collapse]').on('click', function (e) { + e.preventDefault(); + var tableId = e.target.getAttribute("data-datatables-collapse"); + var table = $("#" + tableId).DataTable(); + table.rows('.parent').nodes().to$().find('td:first-child').trigger('click'); + }); });