Skip to content

Commit 05e42c6

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Change detect on runtime strategy change.
1 parent 13b4c24 commit 05e42c6

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,6 +2510,9 @@ export abstract class IgxGridBaseDirective implements GridType,
25102510
}
25112511
public set mergeStrategy(value) {
25122512
this._mergeStrategy = value;
2513+
if (!this._init) {
2514+
this.cdr.detectChanges();
2515+
}
25132516
}
25142517

25152518
/**

src/app/grid-cellMerging/grid-cellMerging.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ <h4 class="sample-title">Hierarchical grid with cell merge</h4>
111111
</igx-hierarchical-grid>
112112

113113
<h4 class="sample-title">Tree grid with cell merge</h4>
114-
114+
<button (click)="toggleStrategy()">Toggle strategy</button>
115115
<igx-tree-grid [autoGenerate]="false" [rowSelection]="'single'" [data]="treeData" [cellMergeMode]="'always'" [mergeStrategy]="treeGridMergeStrategy"
116116
childDataKey="ChildCompanies" primaryKey="ID" [expansionDepth]="1" width="800px" [height]="'550px'">
117117
<igx-column field="ContactName" width="200px">

src/app/grid-cellMerging/grid-cellMerging.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, HostBinding, ViewChild } from '@angular/core';
22
import { FormsModule } from '@angular/forms';
33
import {
4+
DefaultTreeGridMergeStrategy,
45
IgxActionStripComponent,
56
IgxButtonDirective,
67
IgxCellTemplateDirective,
@@ -65,6 +66,14 @@ export class GridCellMergingComponent {
6566
@ViewChild('grid1', { static: true }) public grid: IgxGridComponent;
6667
public data = INVOICE_DATA;
6768

69+
public toggleStrategy() {
70+
if (this.treeGridMergeStrategy instanceof ByLevelTreeGridMergeStrategy) {
71+
this.treeGridMergeStrategy = new DefaultTreeGridMergeStrategy();
72+
} else {
73+
this.treeGridMergeStrategy = new ByLevelTreeGridMergeStrategy();
74+
}
75+
}
76+
6877
public searchKeyDown(ev) {
6978
if (ev.key === 'Enter' || ev.key === 'ArrowDown' || ev.key === 'ArrowRight') {
7079
ev.preventDefault();

0 commit comments

Comments
 (0)