From 36086e4b77a6c5d1a476287e5887bc7829cce7b8 Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Thu, 2 Apr 2026 20:38:09 +0530 Subject: [PATCH] relation fixes --- src_generic/components/EnhancedTable.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src_generic/components/EnhancedTable.tsx b/src_generic/components/EnhancedTable.tsx index f1a7120..294c495 100644 --- a/src_generic/components/EnhancedTable.tsx +++ b/src_generic/components/EnhancedTable.tsx @@ -53,6 +53,15 @@ export default function EnhancedTable({ // 2. Relational Link if (field.relation && value) { const relationId = typeof value === 'object' ? (value.id || value._id || value.pk) : value; + const displayValue = + typeof value === "object" + ? ( + (field?.displayField && (value as Record)[field.displayField]) || + (value as any).id || + (value as any)._id || + (value as any).pk + ) + : value; if (relationId) { return ( - {relationId} + {displayValue} ); }