Fix partial swaps on table
This commit is contained in:
parent
32aa93a28e
commit
78b28b3994
|
@ -77,6 +77,7 @@ urlpatterns = [
|
|||
path("__debug__/", include("debug_toolbar.urls")),
|
||||
path("", DrilldownTableView.as_view(), name="home"),
|
||||
path("search/", DrilldownTableView.as_view(), name="search"),
|
||||
path("search/partial/", DrilldownTableView.as_view(), name="search_partial"),
|
||||
path("about/", About.as_view(), name="about"),
|
||||
path("callback", Callback.as_view(), name="callback"),
|
||||
path("billing/", Billing.as_view(), name="billing"),
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{% load joinsep %}
|
||||
{% load urlsafe %}
|
||||
{% block table-wrapper %}
|
||||
<script src="{% static 'js/column-shifter.js' %}"></script>
|
||||
<div id="drilldown-table" class="column-shifter-container" style="position:relative; z-index:1;">
|
||||
{% block table %}
|
||||
<div class="nowrap-parent">
|
||||
|
@ -80,11 +81,11 @@
|
|||
</div>
|
||||
<div class="nowrap-child">
|
||||
<a
|
||||
hx-get="search/{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}&{{ uri }}"
|
||||
hx-get="search/partial/{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}&{{ uri }}"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-trigger="click"
|
||||
hx-target="#drilldown-table"
|
||||
hx-swap="innerHTML"
|
||||
hx-swap="outerHTML"
|
||||
hx-indicator="#spinner"
|
||||
style="cursor: pointer;">
|
||||
{{ column.header }}
|
||||
|
@ -421,11 +422,11 @@
|
|||
<a
|
||||
class="pagination-previous is-flex-grow-0 {% if not table.page.has_previous %}is-hidden-mobile{% endif %}"
|
||||
{% if table.page.has_previous %}
|
||||
hx-get="search/{% querystring table.prefixed_page_field=table.page.previous_page_number %}&{{ uri }}"
|
||||
hx-get="search/partial/{% querystring table.prefixed_page_field=table.page.previous_page_number %}&{{ uri }}"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-trigger="click"
|
||||
hx-target="#drilldown-table"
|
||||
hx-swap="innerHTML"
|
||||
hx-swap="outerHTML"
|
||||
hx-indicator="#spinner"
|
||||
{% else %}
|
||||
href="#"
|
||||
|
@ -441,11 +442,11 @@
|
|||
<a
|
||||
class="pagination-next is-flex-grow-0 {% if not table.page.has_next %}is-hidden-mobile{% endif %}"
|
||||
{% if table.page.has_next %}
|
||||
hx-get="search/{% querystring table.prefixed_page_field=table.page.next_page_number %}&{{ uri }}"
|
||||
hx-get="search/partial/{% querystring table.prefixed_page_field=table.page.next_page_number %}&{{ uri }}"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-trigger="click"
|
||||
hx-target="#drilldown-table"
|
||||
hx-swap="innerHTML"
|
||||
hx-swap="outerHTML"
|
||||
hx-indicator="#spinner"
|
||||
{% else %}
|
||||
href="#"
|
||||
|
@ -470,11 +471,11 @@
|
|||
{% if p == table.page.number %}
|
||||
href="#"
|
||||
{% else %}
|
||||
hx-get="search/{% querystring table.prefixed_page_field=p %}&{{ uri }}"
|
||||
hx-get="search/partial/{% querystring table.prefixed_page_field=p %}&{{ uri }}"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-trigger="click"
|
||||
hx-target="#drilldown-table"
|
||||
hx-swap="innerHTML"
|
||||
hx-swap="outerHTML"
|
||||
hx-indicator="#spinner"
|
||||
{% endif %}
|
||||
>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{% load static %}
|
||||
|
||||
{% include 'partials/notify.html' %}
|
||||
<script src="{% static 'js/column-shifter.js' %}"></script>
|
||||
{% if cache is not None %}
|
||||
<span class="icon has-tooltip-bottom" data-tooltip="Cached">
|
||||
<i class="fa-solid fa-database"></i>
|
||||
|
|
|
@ -115,6 +115,9 @@ class DrilldownTableView(SingleTableView):
|
|||
self.template_name = "index.html"
|
||||
# GET arguments in URL like ?query=xyz
|
||||
query_params = request.GET.dict()
|
||||
if request.htmx:
|
||||
if request.resolver_match.url_name == "search_partial":
|
||||
self.template_name = "partials/results_table.html"
|
||||
elif request.POST:
|
||||
query_params = request.POST.dict()
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue