From 5f3932b7e1843340bfdac35d5c6f07ae3344535c Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 19 Feb 2024 12:47:18 +1100 Subject: [PATCH] Tweak PartParameterTable (#6512) - Fix ordering of "name" field --- InvenTree/part/api.py | 2 ++ src/frontend/src/tables/part/PartParameterTable.tsx | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 3b019296bc..ccfa5676b3 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -1595,7 +1595,9 @@ class PartParameterList(PartParameterAPIMixin, ListCreateAPI): ordering_field_aliases = { 'name': 'template__name', + 'units': 'template__units', 'data': ['data_numeric', 'data'], + 'part': 'part__name', } search_fields = [ diff --git a/src/frontend/src/tables/part/PartParameterTable.tsx b/src/frontend/src/tables/part/PartParameterTable.tsx index 8002a736e9..d9f6ce4f4e 100644 --- a/src/frontend/src/tables/part/PartParameterTable.tsx +++ b/src/frontend/src/tables/part/PartParameterTable.tsx @@ -44,6 +44,7 @@ export function PartParameterTable({ partId }: { partId: any }) { accessor: 'template_detail.name', switchable: false, sortable: true, + ordering: 'name', render: (record) => { let variant = String(partId) != String(record.part); @@ -75,7 +76,8 @@ export function PartParameterTable({ partId }: { partId: any }) { }, { accessor: 'template_detail.units', - sortable: false + ordering: 'units', + sortable: true } ]; }, [partId]);