From 3b4f1d957d93442c7d42b420d0283e126e5f4fe9 Mon Sep 17 00:00:00 2001 From: cbourget Date: Fri, 15 Feb 2019 15:49:06 -0500 Subject: [PATCH] feat(entity table): allow multiple selections --- .../src/lib/entity/entity-table/entity-table.component.ts | 4 +++- projects/common/src/lib/entity/shared/entity.interfaces.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/common/src/lib/entity/entity-table/entity-table.component.ts b/projects/common/src/lib/entity/entity-table/entity-table.component.ts index b0f772f38e..99a8aad024 100644 --- a/projects/common/src/lib/entity/entity-table/entity-table.component.ts +++ b/projects/common/src/lib/entity/entity-table/entity-table.component.ts @@ -162,7 +162,9 @@ export class EntityTableComponent implements OnInit, OnDestroy, OnChanges { */ onRowSelect(entity: object) { if (this.selection === false) { return; } - this.store.state.update(entity, {selected: true}, true); + + const many = this.template.selectMany ? this.template.selectMany : false; + this.store.state.update(entity, {selected: true}, !many); this.entitySelectChange.emit({selected: true, entity}); } diff --git a/projects/common/src/lib/entity/shared/entity.interfaces.ts b/projects/common/src/lib/entity/shared/entity.interfaces.ts index 76e503f828..ea81c4cf4e 100644 --- a/projects/common/src/lib/entity/shared/entity.interfaces.ts +++ b/projects/common/src/lib/entity/shared/entity.interfaces.ts @@ -59,6 +59,7 @@ export interface EntityOperationState { export interface EntityTableTemplate { columns: EntityTableColumn[]; selection?: boolean; + selectMany?: boolean; sort?: boolean; valueAccessor?: (entity: object, property: string) => any; rowClassFunc?: (entity: object) => {