From 553d4fd33fac2c420aca8bdc1215e059410a48d9 Mon Sep 17 00:00:00 2001
From: Mark Veidemanis
Date: Fri, 26 Aug 2022 07:20:30 +0100
Subject: [PATCH] Fix setting up widgets containing HTMX code and unify the
flow for results and widgets
---
core/templates/ui/drilldown/drilldown.html | 6 ++----
core/templates/widgets/drilldown.html | 14 ++++----------
core/templates/widgets/table_results.html | 13 ++-----------
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/core/templates/ui/drilldown/drilldown.html b/core/templates/ui/drilldown/drilldown.html
index fc91744..227a4b4 100644
--- a/core/templates/ui/drilldown/drilldown.html
+++ b/core/templates/ui/drilldown/drilldown.html
@@ -83,13 +83,11 @@
// GridStack.init();
setupTags();
document.addEventListener('load-widget', function(event) {
- grid.removeWidget("drilldown-widget-results");
-
let container = htmx.find('#drilldown-widget');
var scripts = htmx.findAll(container, "script");
let widgetelement = container.firstElementChild.cloneNode(true);
- container.firstElementChild.remove();
- //let grid = document.querySelector('.grid-stack').gridstack;
+ container.outerHTML = "";
+
grid.addWidget(widgetelement);
htmx.process(widgetelement);
diff --git a/core/templates/widgets/drilldown.html b/core/templates/widgets/drilldown.html
index 7420d91..b3bb94a 100644
--- a/core/templates/widgets/drilldown.html
+++ b/core/templates/widgets/drilldown.html
@@ -11,24 +11,18 @@
-
- {% include 'window-content/drilldown.html' %}
-
+ {% include 'window-content/drilldown.html' %}
+
\ No newline at end of file
diff --git a/core/templates/widgets/table_results.html b/core/templates/widgets/table_results.html
index af72326..69d0711 100644
--- a/core/templates/widgets/table_results.html
+++ b/core/templates/widgets/table_results.html
@@ -1,6 +1,6 @@
{% load static %}
-