Skip to content

Commit be7de3e

Browse files
committed
fix(filter-ui): hide filtering row on column hide #6520
1 parent 03030ba commit be7de3e

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-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
@@ -252,6 +252,7 @@ export class IgxColumnComponent implements AfterContentInit {
252252
this.grid.summaryService.resetSummaryHeight();
253253
this.grid.filteringService.refreshExpressions();
254254
this.grid.notifyChanges();
255+
this.grid.filteringService.hideColumnFilteringRowOnVisibilityChange(this);
255256
}
256257
}
257258
}

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
@@ -116,13 +116,17 @@ export class IgxFilteringService implements OnDestroy {
116116
filterCell.updateFilterCellArea();
117117
});
118118
});
119+
}
120+
}
119121

120-
this.grid.onColumnVisibilityChanged.pipe(takeUntil(this.destroy$)).subscribe((eventArgs: IColumnVisibilityChangedEventArgs) => {
121-
if (this.grid.filteringRow && this.grid.filteringRow.column === eventArgs.column ) {
122-
this.grid.filteringRow.close();
122+
/**
123+
* Close filtering row if a column is hidden.
124+
*/
125+
public hideColumnFilteringRowOnVisibilityChange(col: IgxColumnComponent) {
126+
const filteringRow = col.grid.filteringRow;
123127

124-
}
125-
});
128+
if (filteringRow && filteringRow.column) {
129+
filteringRow.close();
126130
}
127131
}
128132

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

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

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

21372136
// Check that the filterRow is opened
2138-
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2137+
let filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
21392138
expect(filterUIRow).not.toBeNull();
21402139

21412140
// Add first chip.
21422141
GridFunctions.typeValueInFilterRowInput('a', fix);
21432142
tick(100);
21442143

21452144
grid.getColumnByName('ProductName').hidden = true;
2146-
fix.detectChanges();
21472145
tick(100);
2146+
fix.detectChanges();
21482147

21492148
// Check that the filterRow is closed
2150-
expect(fix.debugElement.query(By.css(FILTER_UI_ROW))).toBeNull();
2151-
expect(grid.rowList.length).toBe(8);
2149+
filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2150+
expect(filterUIRow).toBeNull();
21522151
}));
21532152

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

0 commit comments

Comments
 (0)