From 2f425fda3489b604dff52366742ca218ef671012 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 7 Apr 2025 13:48:04 -0400 Subject: [PATCH] Update table config link when updating table --- netbox/netbox/tables/tables.py | 9 +++++++++ netbox/templates/htmx/table.html | 3 +++ netbox/templates/inc/table_controls_htmx.html | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/netbox/netbox/tables/tables.py b/netbox/netbox/tables/tables.py index b5e7715ba..cbcccdf92 100644 --- a/netbox/netbox/tables/tables.py +++ b/netbox/netbox/tables/tables.py @@ -1,5 +1,6 @@ from copy import deepcopy from functools import cached_property +from urllib.parse import urlencode import django_tables2 as tables from django.conf import settings @@ -191,6 +192,14 @@ class BaseTable(tables.Table): 'ordering': self.order_by, } + @property + def config_params(self): + return urlencode({ + 'object_type': ObjectType.objects.get_for_model(self.Meta.model).pk, + 'table': self.name, + **self.configuration, + }) + class NetBoxTable(BaseTable): """ diff --git a/netbox/templates/htmx/table.html b/netbox/templates/htmx/table.html index 5728789fa..376764cef 100644 --- a/netbox/templates/htmx/table.html +++ b/netbox/templates/htmx/table.html @@ -19,6 +19,9 @@ {# Include the updated object count for display elsewhere on the page #}
{{ table.rows|length }}
+ {# Include the updated "save" link for the table configuration #} + Save + {# Update the bulk action buttons with new query parameters #} {% if actions %}
diff --git a/netbox/templates/inc/table_controls_htmx.html b/netbox/templates/inc/table_controls_htmx.html index e312008c9..29a2c47c6 100644 --- a/netbox/templates/inc/table_controls_htmx.html +++ b/netbox/templates/inc/table_controls_htmx.html @@ -34,7 +34,7 @@ Toggle Dropdown