Adds a new text generator for the patron barcode template in the staff
catalog holds grid. Also adds a name field to the <eg-grid-column/>
to support the text generator.
Teach the cell text generator internals to translate undefined and null
values to '' so generator authors don't have to.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
getColumnTextContent(row: any, col: GridColumn): string {
if (this.columnHasTextGenerator(col)) {
- return this.cellTextGenerator[col.name](row);
+ const str = this.cellTextGenerator[col.name](row);
+ return (str === null || str === undefined) ? '' : str;
} else {
if (col.cellTemplate) {
return ''; // avoid 'undefined' values
{{hold.ucard_barcode}}
</a>
</ng-template>
- <eg-grid-column i18n-label label="Patron Barcode"
+ <eg-grid-column i18n-label label="Patron Barcode" name="patron_barcode"
[cellTemplate]="userBarcodeTmpl" [hidden]="true"></eg-grid-column>
<eg-grid-column i18n-label label="Patron alias" path="usr_alias"></eg-grid-column>
// Text-ify function for cells that use display templates.
this.cellTextGenerator = {
title: row => row.title,
- cp_barcode: row => (row.cp_barcode == null) ? '' : row.cp_barcode
+ cp_barcode: row => (row.cp_barcode == null) ? '' : row.cp_barcode,
+ patron_barcode: row => row.ucard_barcode
};
}