User Tools

Site Tools


newdevs:code:grid-cell-text-generator

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 Title Field in Holds Pull List

1. An ng-template block in in staff/share/holds/grid.component.html is created to turn the title column into a link to the record page:

<ng-template #titleTmpl let-hold="row">
    <a class="no-href" routerLink="/staff/catalog/record/{{hold.record_id}}">
        {{hold.title}}
    </a>
</ng-template>

<eg-grid-column i18n-label label="Title" [hidden]="true" name='title'
    [cellTemplate]="titleTmpl">
</eg-grid-column>

2. The eg-grid tag should include

[cellTextGenerator]="cellTextGenerator"

3. The grid.component.ts file must include the ability to use GridCellTextGenerator:

import {GridDataSource, GridColumn, GridRowFlairEntry, GridCellTextGenerator} from '@eg/share/grid/grid';

and then inside the class:

cellTextGenerator: GridCellTextGenerator;

4. And then inside ngOnInit - the grid.component.ts file is modified to specify the alternate text that should print out:

this.cellTextGenerator = {
    title: row => row.title
};
newdevs/code/grid-cell-text-generator.txt · Last modified: 2023/12/21 16:55 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.