Skip to content

Commit 45ed308

Browse files
authored
Merge pull request #14877 from IgniteUI/sstoychev/group-by-update-title-m
fix(groupby): using pipetrigger for chip titles too
2 parents 479a883 + 1e06f11 commit 45ed308

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid.groupby.spec.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,28 @@ describe('IgxGrid - GroupBy #grid', () => {
21752175
expect(fix.componentInstance.onGroupByRowClick).toHaveBeenCalledWith(fix.componentInstance.groupByRowClick, contextUnselect);
21762176
}));
21772177

2178+
it('should update chips state when columns are added/removed', fakeAsync(() => {
2179+
const fix = TestBed.createComponent(GroupByDataMoreColumnsComponent);
2180+
const cols = fix.componentInstance.columns;
2181+
fix.componentInstance.columns = [];
2182+
fix.componentInstance.instance.groupingExpressions = [
2183+
{
2184+
dir: SortingDirection.Asc,
2185+
fieldName: 'A',
2186+
ignoreCase: false,
2187+
strategy: DefaultSortingStrategy.instance()
2188+
}
2189+
];
2190+
fix.detectChanges();
2191+
const chips = fix.componentInstance.instance.groupArea.chips;
2192+
let chipContent = chips.first.nativeElement.querySelector('.igx-chip__content').textContent.trim();
2193+
expect(chipContent).toBe('A');
2194+
fix.componentInstance.columns = cols;
2195+
fix.detectChanges();
2196+
chipContent = chips.first.nativeElement.querySelector('.igx-chip__content').textContent.trim();
2197+
expect(chipContent).toBe('AA');
2198+
}));
2199+
21782200
// GroupBy Row Formatting
21792201
it('should properly apply formatters, both custom and default ones for the default row value template', fakeAsync(() => {
21802202
const fix = TestBed.createComponent(GroupableGridComponent);
@@ -4103,7 +4125,7 @@ export class CustomTemplateGridComponent extends DataParent {
41034125
[width]='width'
41044126
[height]='height'
41054127
[data]="testData">
4106-
<igx-column *ngFor="let c of columns" [groupable]="true" [field]="c.field" [header]="c.field" [width]="c.width + 'px'">
4128+
<igx-column *ngFor="let c of columns" [groupable]="true" [field]="c.field" [header]="c.header || c.field" [width]="c.width + 'px'">
41074129
</igx-column>
41084130
</igx-grid>
41094131
`,
@@ -4119,7 +4141,7 @@ export class GroupByDataMoreColumnsComponent extends DataParent {
41194141
public testData = [];
41204142

41214143
public columns = [
4122-
{ field: 'A', width: 100 },
4144+
{ field: 'A', header: 'AA', width: 100 },
41234145
{ field: 'B', width: 100 },
41244146
{ field: 'C', width: 100 },
41254147
{ field: 'D', width: 100 },

projects/igniteui-angular/src/lib/grids/grouping/group-by-area.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<ng-container *ngFor="let expression of chipExpressions; let last = last;">
33
<igx-chip
44
[id]="expression.fieldName"
5-
[title]="(expression.fieldName | igxGroupByMeta:grid).title"
5+
[title]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).title"
66
[removable]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
77
[draggable]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
88
[disabled]="!(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
99
(keyDown)="handleKeyDown($event.owner.id, $event.originalEvent)"
1010
(remove)="clearGrouping($event.owner.id)"
1111
(chipClick)="handleClick(expression.fieldName)"
1212
>
13-
<span>{{ (expression.fieldName | igxGroupByMeta:grid).title }}</span>
13+
<span>{{ (expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).title }}</span>
1414
<igx-icon
1515
family="default"
1616
[name]="expression.dir === 1 ? 'sort_asc' : 'sort_desc'"

0 commit comments

Comments
 (0)