LP1904036 Grid flat data service/support
authorBill Erickson <berickxx@gmail.com>
Mon, 19 Apr 2021 16:44:01 +0000 (12:44 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:32 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
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':