From bd4aaf508626ae41da8332c8c0931592d52ea881 Mon Sep 17 00:00:00 2001 From: ViktorSlavov Date: Mon, 17 Dec 2018 18:26:16 +0200 Subject: [PATCH] refactor(grid): move deleted checks to API, remove extra loop, #3424 --- .../src/lib/grids/grid-base.component.ts | 11 +++++----- .../grids/tree-grid/tree-grid-api.service.ts | 21 ++++++++++++++++++- .../tree-grid/tree-grid-row.component.ts | 20 +----------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/grid-base.component.ts b/projects/igniteui-angular/src/lib/grids/grid-base.component.ts index 7efe53a9a9a..3ca3f567c09 100644 --- a/projects/igniteui-angular/src/lib/grids/grid-base.component.ts +++ b/projects/igniteui-angular/src/lib/grids/grid-base.component.ts @@ -3315,8 +3315,8 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements * @hidden */ public refreshGridState(args?) { - this.endEdit(true); - this.summaryService.clearSummaryCache(args); + this.endEdit(true); + this.summaryService.clearSummaryCache(args); } // TODO: We have return values here. Move them to event args ?? @@ -3795,7 +3795,8 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements protected _disableMultipleSummaries(expressions) { expressions.forEach((column) => { const columnName = column && column.fieldName ? column.fieldName : column; - this._summaries(columnName, false); }); + this._summaries(columnName, false); + }); } /** @@ -4023,9 +4024,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements let newSelection: Set; let selectableRows = []; if (this.transactions.enabled) { - for (let i = 0; i < rowIDs.length; i++) { - selectableRows = rowIDs.filter( e => !this.gridAPI.row_deleted_transaction(this.id, e)); - } + selectableRows = rowIDs.filter(e => !this.gridAPI.row_deleted_transaction(this.id, e)); } else { selectableRows = rowIDs; } diff --git a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts index 4cb76ce2ff2..dc0f2174baa 100644 --- a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts +++ b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-api.service.ts @@ -5,7 +5,7 @@ import { ITreeGridRecord } from './tree-grid.interfaces'; import { IRowToggleEventArgs } from './tree-grid.interfaces'; import { IgxColumnComponent } from '../column.component'; import { first } from 'rxjs/operators'; -import { HierarchicalTransaction, TransactionType } from '../../services'; +import { HierarchicalTransaction, TransactionType, State } from '../../services'; import { mergeObjects } from '../../core/utils'; export class IgxTreeGridAPIService extends GridBaseAPIService { @@ -174,4 +174,23 @@ export class IgxTreeGridAPIService extends GridBaseAPIService