From 2189381fa651ae3e37cc1d9bce129a888f44ecfc Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 26 Aug 2022 07:20:30 +0100 Subject: [PATCH] Make widgets play nice with HTMX --- core/templates/base.html | 2 +- core/templates/ui/drilldown/drilldown.html | 53 ++++++++++++---------- core/templates/widgets/table_results.html | 27 ++++++----- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/core/templates/base.html b/core/templates/base.html index 13dd79f..f4344b0 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -19,7 +19,7 @@ - + diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html index b225dee..fc91744 100644 --- a/core/templates/ui/drilldown/drilldown.html +++ b/core/templates/ui/drilldown/drilldown.html @@ -70,6 +70,35 @@ + + +
@@ -82,31 +111,7 @@ {% endif %}
- {% if table %} - - {% endif %} {% endblock %} diff --git a/core/templates/widgets/table_results.html b/core/templates/widgets/table_results.html index a281ee4..af72326 100644 --- a/core/templates/widgets/table_results.html +++ b/core/templates/widgets/table_results.html @@ -52,17 +52,16 @@ \ No newline at end of file + // let container = htmx.find('#drilldown-widget'); + // var scripts = container.getElementsByTagName("script"); + // let widgetelement = container.firstElementChild.cloneNode(true); + // container.firstElementChild.remove(); + // //let grid = document.querySelector('.grid-stack').gridstack; + // grid.addWidget(widgetelement); + // htmx.process(widgetelement); + // for (var i = 0; i < scripts.length; i++) { + // eval(scripts[i].innerHTML); + // } + var widget_event = new Event('load-widget'); + document.dispatchEvent(widget_event); +