Skip to content

Commit cac76f2

Browse files
authored
Merge pull request #4941 from IgniteUI/mkirova/fix-4714-7.3.x
fix(Grid): hideGroupedColumns option should have no effect in MRL grid.
2 parents 7477dfe + c1524fb commit cac76f2

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid.component.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,12 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
631631
}
632632

633633
private _setGroupColsVisibility(value) {
634-
this.groupingExpressions.forEach((expr) => {
635-
const col = this.getColumnByName(expr.fieldName);
636-
col.hidden = value;
637-
});
634+
if (this.columnList && !this.hasColumnLayouts) {
635+
this.groupingExpressions.forEach((expr) => {
636+
const col = this.getColumnByName(expr.fieldName);
637+
col.hidden = value;
638+
});
639+
}
638640
}
639641

640642
/**
@@ -872,7 +874,7 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
872874

873875
public ngDoCheck(): void {
874876
super.ngDoCheck();
875-
if (this.groupingDiffer) {
877+
if (this.groupingDiffer && this.columnList && !this.hasColumnLayouts) {
876878
const changes = this.groupingDiffer.diff(this.groupingExpressions);
877879
if (changes && this.columnList) {
878880
changes.forEachAddedItem((rec) => {

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.spec.ts

+30
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,36 @@ describe('IgxGrid - multi-row-layout', () => {
11321132
const groupRowBlocks = fixture.debugElement.query(By.css('.igx-grid__tbody')).queryAll(By.css('.igx-grid__mrl-block'));
11331133
expect(groupRowBlocks[0].nativeElement.style.gridTemplateColumns).toEqual('118px 118px 118px 118px 118px 118px');
11341134
});
1135+
1136+
it('should disregard hideGroupedColumns option and not hide columns when grouping when having column layouts.', () => {
1137+
const fixture = TestBed.createComponent(ColumnLayoutTestComponent);
1138+
fixture.componentInstance.colGroups = [{
1139+
group: 'group1',
1140+
columns: [
1141+
{ field: 'ContactName', rowStart: 1, colStart: 1, colEnd : 4},
1142+
{ field: 'ContactTitle', rowStart: 1, colStart: 4, colEnd: 6},
1143+
{ field: 'Country', rowStart: 1, colStart: 6, colEnd: 7},
1144+
{ field: 'Phone', rowStart: 2, colStart: 1, colEnd: 3},
1145+
{ field: 'City', rowStart: 2, colStart: 3, colEnd: 5},
1146+
{ field: 'Address', rowStart: 2, colStart: 5, colEnd: 7},
1147+
{ field: 'CompanyName', rowStart: 3, colStart: 1, colEnd: 2},
1148+
{ field: 'PostalCode', rowStart: 3, colStart: 2, colEnd: 3},
1149+
{ field: 'Fax', rowStart: 3, colStart: 3, colEnd: 7},
1150+
]
1151+
}];
1152+
const grid = fixture.componentInstance.grid;
1153+
grid.hideGroupedColumns = true;
1154+
fixture.detectChanges();
1155+
1156+
grid.groupBy({ fieldName: 'ContactTitle', dir: SortingDirection.Desc, ignoreCase: false,
1157+
strategy: DefaultSortingStrategy.instance() });
1158+
fixture.detectChanges();
1159+
1160+
// check column and group are not hidden
1161+
const col = grid.getColumnByName('ContactTitle');
1162+
expect(col.hidden).toBe(false);
1163+
expect(col.parent.hidden).toBe(false);
1164+
});
11351165
});
11361166

11371167
@Component({

0 commit comments

Comments
 (0)