const columns = this.gridContext.columnSet.displayColumns();
const textItems = {columns: columns, rows: []};
+ // Warn on missing print value generators for cells using templates.
+ columns.forEach(col => {
+ if (col.cellTemplate && !col.cellPrintValue) {
+ console.warn("No print value generator set for: " + col.name);
+ }
+ });
+
this.gridContext.getAllRowsAsText().subscribe(
row => {
this.progressDialog.increment();
</eg-grid-toolbar-button>
<eg-grid-toolbar-action label="Delete Selected" i18n-label
[action]="deleteSelected"></eg-grid-toolbar-action>
- <eg-grid-column name="name" [cellTemplate]="nameTmpl">
+ <eg-grid-column name="name" [cellTemplate]="nameTmpl" [cellPrintValue]="cellPrintValues">
</eg-grid-column>
</eg-grid>
@ViewChild('grid', { static: true }) grid: GridComponent;
@ViewChild('editDialog', { static: true }) editDialog: FmRecordEditorComponent;
+ cellPrintValues: (row: any, cell: GridColumn) => string;
+
constructor(
private router: Router,
private pcrud: PcrudService,
});
};
+ // Text-ify function for cells that use display templates.
+ this.cellPrintValues = (row: any, cell: GridColumn): string => {
+ switch (cell.name) {
+ case 'name':
+ return row.name();
+ }
+ };
+
this.createNew = () => {
this.editDialog.mode = 'create';
this.editDialog.open({size: 'lg'})
(onChange)="limitToImportErrors($event)"></eg-grid-toolbar-checkbox>
<eg-grid-column name="id" [index]="true" [hidden]="true"></eg-grid-column>
- <eg-grid-column i18n-label label="Matches"
- name="+matches" [cellTemplate]="matchesTmpl"></eg-grid-column>
+ <eg-grid-column i18n-label label="Matches" name="+matches"
+ [cellTemplate]="matchesTmpl" [cellPrintValue]="cellPrintValues"></eg-grid-column>
<eg-grid-column name="import_error" i18n-label
- label="Import Errors" [cellTemplate]="errorsTmpl"></eg-grid-column>
+ label="Import Errors" [cellTemplate]="errorsTmpl"
+ [cellPrintValue]="cellPrintValues"></eg-grid-column>
<eg-grid-column name="import_time" i18n-label
label="Import Date" datatype="timestamp"></eg-grid-column>
- <eg-grid-column name="imported_as" i18n-label
- label="Imported As" [cellTemplate]="importedAsTmpl"></eg-grid-column>
+ <eg-grid-column name="imported_as" i18n-label label="Imported As"
+ [cellTemplate]="importedAsTmpl" [cellPrintValue]="cellPrintValues"></eg-grid-column>
</eg-grid>
@ViewChild('confirmDelDlg', { static: false }) confirmDelDlg: ConfirmDialogComponent;
@ViewChild('progressDlg', { static: true }) progressDlg: ProgressDialogComponent;
+ cellPrintValues: (row: any, cell: GridColumn) => string;
+
constructor(
private router: Router,
private route: ActivatedRoute,
return this.loadQueueRecords(pager);
};
+ // Text-ify function for cells that use display templates.
+ this.cellPrintValues = (row: any, cell: GridColumn): string => {
+ return ({
+ '+matches': row.matches.length + '',
+ 'import_error': row.import_error,
+ 'imported_as': row.imported_as + ''
+ })[cell.name] || '';
+ };
}
ngOnInit() {
i18n-label label="Match ID">
</eg-grid-column>
<eg-grid-column name="selected" i18n-label label="Merge Target"
- [cellTemplate]="targetTemplate">
+ [cellTemplate]="targetTemplate" [cellPrintValue]="cellPrintValues">
</eg-grid-column>
<eg-grid-column name="eg_record" i18n-label label="Record ID"
- [cellTemplate]="bibIdTemplate">
+ [cellTemplate]="bibIdTemplate" [cellPrintValue]="cellPrintValues">
</eg-grid-column>
<eg-grid-column name="match_score" i18n-label label="Match Score">
</eg-grid-column>
matchRowClick: (row: any) => void;
matchMap: {[id: number]: IdlObject};
+ cellPrintValues: (row: any, cell: GridColumn) => string;
+
constructor(
private router: Router,
private route: ActivatedRoute,
return this.getBibMatchRows(pager);
};
+ // Text-ify function for cells that use display templates.
+ this.cellPrintValues = (row: any, cell: GridColumn): string => {
+ return ({
+ 'selected': this.isOverlayTarget(row.id) + '',
+ 'eg_record': row.eg_record + ''
+ })[cell.name] || '';
+ };
+
+
/* TODO
this.authDataSource.getRows = (pager: Pager) => {
}
</a>
</ng-template>
<eg-grid-column i18n-label label="Current Item" name='cp_barcode'
- [cellTemplate]="barcodeTmpl">
+ [cellTemplate]="barcodeTmpl" [cellPrintValue]="cellPrintValues">
</eg-grid-column>
<ng-template #userBarcodeTmpl let-hold="row">
{{hold.title}}
</a>
</ng-template>
- <eg-grid-column i18n-label label="Title" [hidden]="true"
- name='title' [cellTemplate]="titleTmpl"></eg-grid-column>
+ <eg-grid-column i18n-label label="Title" [hidden]="true" name='title'
+ [cellTemplate]="titleTmpl" [cellPrintValue]="cellPrintValues"></eg-grid-column>
<eg-grid-column i18n-label label="Author" path='author'
[hidden]="true"></eg-grid-column>
<eg-grid-column i18n-label label="Potential Items" path='potentials' datatype="int">
import {AuthService} from '@eg/core/auth.service';
import {Pager} from '@eg/share/util/pager';
import {ServerStoreService} from '@eg/core/server-store.service';
-import {GridDataSource} from '@eg/share/grid/grid';
+import {GridDataSource, GridColumn} from '@eg/share/grid/grid';
import {GridComponent} from '@eg/share/grid/grid.component';
import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
import {MarkDamagedDialogComponent
}
}
+ cellPrintValues: (row: any, cell: GridColumn) => string;
+
constructor(
private net: NetService,
private org: OrgService,
sort = sort.length > 0 ? sort : this.defaultSort;
return this.fetchHolds(pager, sort);
};
+
+ // Text-ify function for cells that use display templates.
+ this.cellPrintValues = (row: any, cell: GridColumn): string => {
+ return ({
+ 'title': row.title,
+ 'cp_barcode': row.cp_barcode
+ })[cell.name] || '';
+ };
}
// Returns true after all data/settings/etc required to render the