{% comment %}
DataTables init for the audit list/detail tables. Included into the
``extra_javascript`` block by each template that renders a
``<table data-audit-table>``. Pulls DataTables from AA's opt-in
bundle (v1.13.7); this is JS wiring, not display-value computation,
so it does not violate the thin-template convention. Each table
declares its own config via data-attributes:
  data-order  : JSON array, DataTables v1 ``order`` option (default sort)
  data-paging : "false" to disable client paging (findings + cap fallback)
{% endcomment %}
{% include "bundles/datatables-css-bs5.html" %}
{% include "bundles/datatables-js-bs5.html" %}
<script>
    $(function () {
        document.querySelectorAll("[data-audit-table]").forEach(function (el) {
            var $el = $(el);
            $el.DataTable({
                paging: $el.data("paging") !== false,
                order: $el.data("order") || [],
                searching: true,
                info: true,
                lengthChange: $el.data("paging") !== false
            });
        });
    });
</script>
