Skip to content

Commit e9b1515

Browse files
DiyanDimitrovgedinakova
authored andcommitted
Fix (Blanks) selection for empty string (#4914)
* test(filtering): add test for issue #4875 * fix(filtering): fix blanks for empty string #4875 * test(filtering): remove detectChanges, fix test name #4875
1 parent d40c810 commit e9b1515

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

projects/igniteui-angular/src/lib/grids/filtering/excel-style/grid.excel-style-filtering.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy, AfterView
316316
return true;
317317
}
318318

319+
if (this.filterValues.size === 1) {
320+
const firstValue = this.filterValues.values().next().value;
321+
322+
if (!firstValue && firstValue !== 0) {
323+
return true;
324+
}
325+
}
326+
319327
for (let index = 0; index < this.uniqueValues.length; index++) {
320328
if (this.filterValues.has(this.uniqueValues[index])) {
321329
return true;

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,6 +3930,25 @@ describe('IgxGrid - Filtering actions - Excel style filtering', () => {
39303930
[ true, true, true ]);
39313931
}));
39323932

3933+
it('Should select (Blanks) when the blank value is empty string.', fakeAsync(() => {
3934+
grid.data[0].AnotherField = '';
3935+
fix.detectChanges();
3936+
3937+
openExcelMenu(fix, 5);
3938+
verifyExcelStyleFilterAvailableOptions(grid,
3939+
[ 'Select All', '(Blanks)', 'a', 'custom' ],
3940+
[ true, true, true, true ]);
3941+
3942+
toggleExcelStyleFilteringItems(fix, grid, true, 2, 3);
3943+
3944+
expect(grid.rowList.length).toBe(1);
3945+
3946+
openExcelMenu(fix, 5);
3947+
verifyExcelStyleFilterAvailableOptions(grid,
3948+
[ 'Select All', '(Blanks)', 'a', 'custom' ],
3949+
[ null, true, false, false ]);
3950+
}));
3951+
39333952
it('Should display the ESF based on the filterIcon within the grid', async() => {
39343953
// Test prerequisites
39353954
grid.width = '800px';

0 commit comments

Comments
 (0)