Skip to content

Commit 8562f8e

Browse files
authored
Merge pull request #8418 from IgniteUI/ibarakov/fix-8372-9.1.x
clear search criteria when selecting "Clear column filters" option
2 parents 1d3b984 + 98abd83 commit 8562f8e

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
998998
*/
999999
public clearFilter() {
10001000
this.filteringService.clearFilter(this.column.field);
1001+
this.excelStyleSearch.clearInput();
10011002
this.selectAllFilterItems();
10021003
}
10031004

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

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,49 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
43694369
expect(listItems[3].innerText).toBe('custoM', 'incorrect list item label');
43704370
expect(listItems[4].innerText).toBe('custom', 'incorrect list item label');
43714371
}));
4372+
4373+
it('Should clear search criteria when selecting clear column filters option.', fakeAsync(() => {
4374+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4375+
4376+
let checkboxes: any = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix));
4377+
4378+
tick(100);
4379+
fix.detectChanges();
4380+
4381+
checkboxes[0].click();
4382+
tick();
4383+
fix.detectChanges();
4384+
4385+
checkboxes[2].click();
4386+
tick();
4387+
fix.detectChanges();
4388+
4389+
GridFunctions.clickApplyExcelStyleFiltering(fix);
4390+
tick(100);
4391+
fix.detectChanges();
4392+
4393+
expect(grid.filteredData.length).toEqual(1);
4394+
4395+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4396+
4397+
let inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4398+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'Net', fix);
4399+
4400+
const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
4401+
expect(listItems.length).toBe(2, 'incorrect rendered list items count');
4402+
4403+
GridFunctions.clickClearFilterInExcelStyleFiltering(fix);
4404+
fix.detectChanges();
4405+
flush();
4406+
4407+
expect(grid.filteredData).toBeNull();
4408+
4409+
inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4410+
expect(inputNativeElement.value).toBe('', 'search criteria is not cleared');
4411+
4412+
checkboxes = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix));
4413+
expect(checkboxes.every(ch => ch.checked)).toBeTrue();
4414+
}));
43724415
});
43734416

43744417
describe(null, () => {
@@ -4627,7 +4670,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
46274670
GridSelectionFunctions.verifyColumnAndCellsSelected(columnId, false);
46284671

46294672
});
4630-
46314673
});
46324674
});
46334675

0 commit comments

Comments
 (0)