because there are a lot of them.
-->
+<ng-template #selectTemplate let-row="row">
+ <ng-container *ngIf="rowIsSelected(row.id)">
+ <span i18n-title title="Row is Selected"
+ class="material-icons">check_circle</span>
+ </ng-container>
+</ng-template>
+
<eg-grid #queueGrid [dataSource]="queueSource"
persistKey="cat.vandelay.queue.{{queueType}}"
(onRowActivate)="openRecord($event)"
+ [disableSelect]="true"
+ (onRowClick)="rowClicked($event)"
[pageOffset]="queuePageOffset()"
hideFields="language,pagination,price,rec_identifier,eg_tcn_source,eg_identifier,item_barcode,zsource">
<eg-grid-toolbar-checkbox i18n-label label="Records with Import Errors"
(onChange)="limitToImportErrors($event)"></eg-grid-toolbar-checkbox>
+ <eg-grid-column name="selected" i18n-label label="Select"
+ [cellTemplate]="selectTemplate"></eg-grid-column>
+
<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>
Boolean(this.vandelay.importSelection.overlayMap[rid]);
}
+ rowIsSelected(rowId: number): boolean {
+ return this.vandelay.importSelection &&
+ this.vandelay.importSelection.recordIds.includes(rowId);
+ }
+
+ rowClicked(row: any) {
+ const selection = this.findOrCreateImportSelection();
+ if (selection.recordIds.includes(row.id)) {
+ selection.recordIds = selection.recordIds.filter(
+ rid => rid !== row.id);
+ } else {
+ selection.recordIds.push(row.id);
+ }
+ }
+
importSelected() {
- const rows = this.queueGrid.context.getSelectedRows();
- if (rows.length) {
- const selection = this.findOrCreateImportSelection();
- selection.recordIds = rows.map(row => row.id);
- console.log('importing: ', this.vandelay.importSelection);
+ const selection = this.findOrCreateImportSelection();
+ if (selection.recordIds.length) {
+ console.debug('importing: ', this.vandelay.importSelection);
this.router.navigate(['/staff/cat/vandelay/import']);
}
}