From a98d7af15cc5854d17e08c1bc55dbe86b5438446 Mon Sep 17 00:00:00 2001 From: Ole Magnus Fon Johnsen Date: Mon, 21 Jul 2025 16:56:33 +0200 Subject: [PATCH 1/2] Add option to tables to make header sticky --- src/templates/django_tables2/header.html | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/templates/django_tables2/header.html b/src/templates/django_tables2/header.html index 366c8883..d2c79627 100644 --- a/src/templates/django_tables2/header.html +++ b/src/templates/django_tables2/header.html @@ -1,25 +1,24 @@ - - + + {% for column in table.columns %} - - {% if column.orderable %} - - {{ column.header }} - {% if column.is_ordered %} - {% if "-" in column.order_by_alias %} - - {% else %} - - {% endif %} - {% else %} - - {% endif %} - + + {% if column.orderable %} + + {{ column.header }} + {% if column.is_ordered %} + {% if '-' in column.order_by_alias %} + + {% else %} + + {% endif %} {% else %} - {{ column.header }} + {% endif %} - + + {% else %} + {{ column.header }} + {% endif %} + {% endfor %} - + From a153acf30f67948fa237deda1c835990c001e268 Mon Sep 17 00:00:00 2001 From: Ole Magnus Fon Johnsen Date: Mon, 21 Jul 2025 16:57:03 +0200 Subject: [PATCH 2/2] Set max height to dashboard tables and make header sticky --- src/staff/tables.py | 8 ++++++++ src/staff/templates/staff/components/order_table.html | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/staff/tables.py b/src/staff/tables.py index 892887d0..a8fb24b6 100644 --- a/src/staff/tables.py +++ b/src/staff/tables.py @@ -576,6 +576,8 @@ class Meta: class NewUnseenOrderTable(StaffIDMixinTable): + sticky_header = True + seen = tables.TemplateColumn( verbose_name="", orderable=False, @@ -619,6 +621,8 @@ class Meta: class NewSeenOrderTable(StaffIDMixinTable): + sticky_header = True + priority = tables.TemplateColumn( orderable=False, verbose_name="Priority", @@ -668,6 +672,8 @@ class Meta: class AssignedOrderTable(StatusMixinTable, StaffIDMixinTable): + sticky_header = True + priority = tables.TemplateColumn( orderable=False, verbose_name="Priority", @@ -699,6 +705,8 @@ class Meta: class DraftOrderTable(StaffIDMixinTable): + sticky_header = True + priority = tables.TemplateColumn( orderable=False, verbose_name="Priority", diff --git a/src/staff/templates/staff/components/order_table.html b/src/staff/templates/staff/components/order_table.html index 2fb0fc1b..80e40b88 100644 --- a/src/staff/templates/staff/components/order_table.html +++ b/src/staff/templates/staff/components/order_table.html @@ -2,5 +2,7 @@

{{ title }} ({{ count }})

- {% render_table table %} +
+ {% render_table table %} +