User Tools

Site Tools


newdevs:code:grid-cell-text-generator

This is an old revision of the document!


New Developers Working Group

Grid Cell Text Generator

When a grid cell (aka, column) is modified to include HTML such as a link, it will not print when printing the full grid unless you take the additional step of telling the system what to print.

Example of the Barcode Field in Holds Pull List

1. The barcode field in staff/share/holds/grid.component.html is modified ng-template so that it links to the item page:

<ng-template #barcodeTmpl let-hold="row" let-col="col">
    <a href="/eg/staff/cat/item/{{hold.cp_id}}/summary">
        <ng-container *ngIf="col.name == 'current_item' && hold.current_copy">
            {{hold.cp_barcode}}
        </ng-container>
        <ng-container *ngIf="col.name == 'requested_item' && isCopyHold(hold)">
            {{hold.cp_barcode}}
        </ng-container>
    </a>
</ng-template>

2. Below that, the grid column is defined:

<eg-grid-column i18n-label label="Current Item" name='current_item'
    [cellTemplate]="barcodeTmpl">
</eg-grid-column>

3. The grid.component.ts file is modified to specify the alternate text that should print out:

this.cellTextGenerator = {
    title: row => row.title,
    cp_barcode: row => (row.cp_barcode == null) ? '' : row.cp_barcode,
    current_item: row => (row.cp_barcode == null) ? '' : row.cp_barcode,
    requested_item: row => (row.cp_barcode == null) ? '' : row.cp_barcode,
    ucard_barcode: row => row.ucard_barcode
};
newdevs/code/grid-cell-text-generator.1680209996.txt.gz · Last modified: 2023/03/30 16:59 by tmccanna

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.