Skip to content

Commit

Permalink
fix(igx-grid): Reset isFilterRowVisible, when changing allowFiltering,
Browse files Browse the repository at this point in the history
  • Loading branch information
sstoyanovIG committed Dec 3, 2018
1 parent a09a3b6 commit 5102352
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
set allowFiltering(value) {
if (this._allowFiltering !== value) {
this._allowFiltering = value;
this.filteringService.isFilterRowVisible = false;
this.filteringService.filteredColumn = null;
this.filteringService.registerSVGIcons();
if (this.gridAPI.get(this.id)) {
this.markForCheck();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,27 @@ describe('IgxGrid - Filtering Row UI actions', () => {
igx_grid_filter_row_close: 'Close'
});
}));

it('Should remove FilterRow, when allowFiltering is set to false.', fakeAsync(() => {
const fix = TestBed.createComponent(IgxGridFilteringComponent);
const grid = fix.componentInstance.grid;
fix.detectChanges();

const initialChips = fix.debugElement.queryAll(By.directive(IgxChipComponent));
const stringCellChip = initialChips[0].nativeElement;

stringCellChip.click();
fix.detectChanges();

let filteringRow = fix.debugElement.query(By.directive(IgxGridFilteringRowComponent));
expect(filteringRow).toBeDefined();

grid.allowFiltering = false;
fix.detectChanges();

filteringRow = fix.debugElement.query(By.directive(IgxGridFilteringRowComponent));
expect(filteringRow).toBeNull();
}));
});

export class CustomFilter extends IgxFilteringOperand {
Expand Down

0 comments on commit 5102352

Please sign in to comment.