From 6c416c1c2a915bcc73c7e5c40e6282bc0524d239 Mon Sep 17 00:00:00 2001 From: MKirova Date: Tue, 29 Mar 2022 19:27:04 +0300 Subject: [PATCH 1/2] fix(igxGrid): Add rowData to pipe triggers so that when data for existing row changes the classes are recalculated. --- projects/igniteui-angular/src/lib/grids/common/pipes.ts | 1 + .../src/lib/grids/grid/grid.component.html | 4 ++-- .../hierarchical-grid/hierarchical-grid.component.html | 4 ++-- .../src/lib/grids/tree-grid/tree-grid.component.html | 4 ++-- src/app/hierarchical-grid/hierarchical-grid.sample.html | 4 ++-- src/app/hierarchical-grid/hierarchical-grid.sample.scss | 5 +++++ src/app/hierarchical-grid/hierarchical-grid.sample.ts | 7 ++++++- 7 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 src/app/hierarchical-grid/hierarchical-grid.sample.scss diff --git a/projects/igniteui-angular/src/lib/grids/common/pipes.ts b/projects/igniteui-angular/src/lib/grids/common/pipes.ts index 0415811d701..6bd196e10c1 100644 --- a/projects/igniteui-angular/src/lib/grids/common/pipes.ts +++ b/projects/igniteui-angular/src/lib/grids/common/pipes.ts @@ -86,6 +86,7 @@ export class IgxGridRowClassesPipe implements PipeTransform { index: number, mrl: boolean, filteredOut: boolean, + _rowData: any, _: number ) { const result = new Set(['igx-grid__tr', index % 2 ? row.grid.evenRowCSS : row.grid.oddRowCSS]); diff --git a/projects/igniteui-angular/src/lib/grids/grid/grid.component.html b/projects/igniteui-angular/src/lib/grids/grid/grid.component.html index 1f14c02d64a..e313ae3b7e8 100644 --- a/projects/igniteui-angular/src/lib/grids/grid/grid.component.html +++ b/projects/igniteui-angular/src/lib/grids/grid/grid.component.html @@ -94,13 +94,13 @@ diff --git a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html index 830c52d00a1..cd2637c6fdb 100644 --- a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html +++ b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html @@ -68,14 +68,14 @@ diff --git a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html index 37f7dcbddfb..bb0de64e479 100644 --- a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html +++ b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html @@ -71,13 +71,13 @@ diff --git a/src/app/hierarchical-grid/hierarchical-grid.sample.html b/src/app/hierarchical-grid/hierarchical-grid.sample.html index 4bbf58636c2..44d9c700776 100644 --- a/src/app/hierarchical-grid/hierarchical-grid.sample.html +++ b/src/app/hierarchical-grid/hierarchical-grid.sample.html @@ -6,10 +6,10 @@

Sample One

style="display: block; width: 500px"> - + #hGrid [rowClasses]="rowClasses"> diff --git a/src/app/hierarchical-grid/hierarchical-grid.sample.scss b/src/app/hierarchical-grid/hierarchical-grid.sample.scss new file mode 100644 index 00000000000..6dddbcf811e --- /dev/null +++ b/src/app/hierarchical-grid/hierarchical-grid.sample.scss @@ -0,0 +1,5 @@ +:host::ng-deep { + .activeRow { + background-color: rgb(201, 241, 201); + } +} diff --git a/src/app/hierarchical-grid/hierarchical-grid.sample.ts b/src/app/hierarchical-grid/hierarchical-grid.sample.ts index f1e547d500e..fa20d37069b 100644 --- a/src/app/hierarchical-grid/hierarchical-grid.sample.ts +++ b/src/app/hierarchical-grid/hierarchical-grid.sample.ts @@ -10,7 +10,7 @@ import { @Component({ selector: 'app-hierarchical-grid-sample', - styleUrls: ['hierarchical-grid.sample.css'], + styleUrls: ['hierarchical-grid.sample.scss'], templateUrl: 'hierarchical-grid.sample.html' }) export class HierarchicalGridSampleComponent implements AfterViewInit { @@ -34,6 +34,11 @@ export class HierarchicalGridSampleComponent implements AfterViewInit { public columns; public childColumns; + public evenCondition = (row: RowType) => parseInt(row.data['ID'], 0) % 2 === 0; + public rowClasses = { + activeRow: this.evenCondition, + }; + constructor(private cdr: ChangeDetectorRef) { this.displayDensities = [ { label: 'compact', selected: this.density === 'compact', togglable: true }, From e963f352ec2b34768bf656898656161c128bfc44 Mon Sep 17 00:00:00 2001 From: MKirova Date: Tue, 29 Mar 2022 19:30:05 +0300 Subject: [PATCH 2/2] chore(*): Add for pivot too. --- .../src/lib/grids/pivot-grid/pivot-grid.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html b/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html index a3a05419774..b25854e66b7 100644 --- a/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html +++ b/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html @@ -51,7 +51,7 @@