Skip to content

Commit

Permalink
Merge pull request #7152 from IgniteUI/ibarakov/fix-6520-9.0.x
Browse files Browse the repository at this point in the history
fix(filter-ui): hide filtering row on column hide #6520
  • Loading branch information
kdinev authored Apr 22, 2020
2 parents 55c61df + 7e15a19 commit 96e0b25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export class IgxColumnComponent implements AfterContentInit {
this.grid.endEdit(false);
this.grid.summaryService.resetSummaryHeight();
this.grid.filteringService.refreshExpressions();
this.grid.filteringService.hideFilteringRowOnColumnVisibilityChange(this);
this.grid.notifyChanges();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,17 @@ export class IgxFilteringService implements OnDestroy {
filterCell.updateFilterCellArea();
});
});
}
}

this.grid.onColumnVisibilityChanged.pipe(takeUntil(this.destroy$)).subscribe((eventArgs: IColumnVisibilityChangedEventArgs) => {
if (this.grid.filteringRow && this.grid.filteringRow.column === eventArgs.column ) {
this.grid.filteringRow.close();
/**
* Close filtering row if a column is hidden.
*/
public hideFilteringRowOnColumnVisibilityChange(col: IgxColumnComponent) {
const filteringRow = this.grid.filteringRow;

}
});
if (filteringRow && filteringRow.column && filteringRow.column === col) {
filteringRow.close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2123,24 +2123,24 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
}));

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

// Check that the filterRow is opened
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
let filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
expect(filterUIRow).not.toBeNull();

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

grid.getColumnByName('ProductName').hidden = true;
fix.detectChanges();
tick(100);
fix.detectChanges();

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

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

0 comments on commit 96e0b25

Please sign in to comment.