Skip to content

Commit 2aa9713

Browse files
committed
fix(Filtering): should not throw error when you filter data column #5551
1 parent 4cacb4c commit 2aa9713

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

projects/igniteui-angular/src/lib/data-operations/filtering-condition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ export class IgxDateFilteringOperand extends IgxFilteringOperand {
390390
}
391391

392392
protected findValueInSet(target: any, searchVal: Set<any>) {
393+
if (!target) { return false; }
393394
return searchVal.has(new Date(target.getFullYear(), target.getMonth(), target.getDate()).toISOString());
394395
}
395396
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4806,6 +4806,34 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
48064806
new Set(['Ignite UI for Angular', 'Ignite UI for JavaScript', 'NetAdvantage']));
48074807
}));
48084808

4809+
it('Should not throw error when selecting more than two values and column dataType is date.', fakeAsync(() => {
4810+
fix.detectChanges();
4811+
4812+
const headers: DebugElement[] = fix.debugElement.queryAll(By.directive(IgxGridHeaderGroupComponent));
4813+
const headerResArea = headers[4].children[0].nativeElement;
4814+
4815+
const filterIcon = headerResArea.querySelector('.igx-excel-filter__icon');
4816+
filterIcon.click();
4817+
fix.detectChanges();
4818+
4819+
const excelMenu = grid.nativeElement.querySelector('.igx-excel-filter__menu');
4820+
const checkbox = excelMenu.querySelectorAll('.igx-checkbox__input');
4821+
const applyButton = excelMenu.querySelector('.igx-button--raised');
4822+
4823+
checkbox[0].click(); // Select All
4824+
tick();
4825+
fix.detectChanges();
4826+
4827+
checkbox[2].click();
4828+
checkbox[3].click();
4829+
checkbox[4].click();
4830+
checkbox[6].click();
4831+
tick();
4832+
fix.detectChanges();
4833+
4834+
expect(() => { applyButton.click(); }).not.toThrowError();
4835+
}));
4836+
48094837
it('Should generate "in" and "empty" conditions when selecting more than two values including (Blanks).', fakeAsync(() => {
48104838
fix.detectChanges();
48114839

0 commit comments

Comments
 (0)