Skip to content

Commit 273b359

Browse files
authored
Merge pull request #7153 from IgniteUI/ibarakov/fix-6520-9.1.x
fix(filter-ui): hide filtering row on column hide #6520
2 parents 9c2f5f8 + 4a6ad74 commit 273b359

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ export class IgxColumnComponent implements AfterContentInit {
276276
this.grid.endEdit(false);
277277
this.grid.summaryService.resetSummaryHeight();
278278
this.grid.filteringService.refreshExpressions();
279+
this.grid.filteringService.hideFilteringRowOnColumnVisibilityChange(this);
279280
this.grid.notifyChanges();
280281
}
281282
}

projects/igniteui-angular/src/lib/grids/filtering/grid-filtering.service.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,17 @@ export class IgxFilteringService implements OnDestroy {
9797
filterCell.updateFilterCellArea();
9898
});
9999
});
100+
}
101+
}
100102

101-
this.grid.onColumnVisibilityChanged.pipe(takeUntil(this.destroy$)).subscribe((eventArgs: IColumnVisibilityChangedEventArgs) => {
102-
if (this.grid.filteringRow && this.grid.filteringRow.column === eventArgs.column ) {
103-
this.grid.filteringRow.close();
103+
/**
104+
* Close filtering row if a column is hidden.
105+
*/
106+
public hideFilteringRowOnColumnVisibilityChange(col: IgxColumnComponent) {
107+
const filteringRow = this.grid.filteringRow;
104108

105-
}
106-
});
109+
if (filteringRow && filteringRow.column && filteringRow.column === col) {
110+
filteringRow.close();
107111
}
108112
}
109113

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,24 +2138,24 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
21382138
}));
21392139

21402140
it('Should close filter row when hide the current column', fakeAsync(() => {
2141-
pending('This issue is failing because of bug #');
21422141
GridFunctions.clickFilterCellChip(fix, 'ProductName');
21432142

21442143
// Check that the filterRow is opened
2145-
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2144+
let filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
21462145
expect(filterUIRow).not.toBeNull();
21472146

21482147
// Add first chip.
21492148
GridFunctions.typeValueInFilterRowInput('a', fix);
21502149
tick(100);
21512150

21522151
grid.getColumnByName('ProductName').hidden = true;
2153-
fix.detectChanges();
21542152
tick(100);
2153+
fix.detectChanges();
21552154

21562155
// Check that the filterRow is closed
2157-
expect(fix.debugElement.query(By.css(FILTER_UI_ROW))).toBeNull();
2158-
expect(grid.rowList.length).toBe(8);
2156+
filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2157+
expect(filterUIRow).toBeNull();
2158+
expect(grid.rowList.length).toBe(3, 'filter is not applied');
21592159
}));
21602160

21612161
it('Should keep existing column filter after hiding another column.', fakeAsync(() => {

0 commit comments

Comments
 (0)