LP1904036 Grid flat data service/support
authorBill Erickson <berickxx@gmail.com>
Mon, 19 Apr 2021 16:44:01 +0000 (12:44 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 6 Oct 2022 16:59:16 +0000 (12:59 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/core/format.service.ts

index b73209b..b58f551 100644 (file)
@@ -107,7 +107,16 @@ export class FormatService {
                     }
 
                 } else {
-                    return value + '';
+
+                    // We have an object with no display selector
+                    // Display its pkey instead to avoid showing [object Object]
+
+                    const pkey = this.idl.classes[params.idlClass].pkey;
+                    if (pkey && typeof value[pkey] === 'function') {
+                        return value[pkey]();
+                    }
+
+                    return '';
                 }
 
             case 'org_unit':