LP1811288 Allow Combobox to default to field id
authorBill Erickson <berickxx@gmail.com>
Mon, 25 Mar 2019 20:29:27 +0000 (20:29 +0000)
committerDan Wells <dbw2@calvin.edu>
Mon, 25 Mar 2019 21:00:53 +0000 (17:00 -0400)
If a combobox field is provided without a label, use the id value as the
display value.  This helps avoid ugly JS errors while trying to format
a null string.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>

Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 272a271..8b018d5 100644 (file)
@@ -102,7 +102,8 @@ export class ComboboxComponent implements OnInit {
         this.defaultSelectionApplied = false;
 
         this.formatDisplayString = (result: ComboboxEntry) => {
-            return result.label.trim();
+            const display = result.label || result.id;
+            return (display + '').trim();
         };
     }