Skip to content

Commit b3bd99c

Browse files
authored
Merge branch '10.1.x' into dTsvetkov/fix-issue-8320-10.1.x
2 parents 29f754a + 8c2bd74 commit b3bd99c

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ export class IgxExcelStyleSearchComponent implements AfterViewInit, OnDestroy {
129129
esf.columnChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
130130
this.virtDir.resetScrollPosition();
131131
});
132+
133+
esf.listDataLoaded.pipe(takeUntil(this.destroy$)).subscribe(() => {
134+
if (this.searchValue) {
135+
this.clearInput();
136+
}
137+
});
132138
}
133139

134140
public ngAfterViewInit() {

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
@@ -284,6 +284,12 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
284284
@Output()
285285
public columnChange = new EventEmitter<IgxColumnComponent>();
286286

287+
/**
288+
* @hidden @internal
289+
*/
290+
@Output()
291+
public listDataLoaded = new EventEmitter();
292+
287293
/**
288294
* @hidden @internal
289295
*/
@@ -554,6 +560,8 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
554560
if (!(this.cdr as any).destroyed) {
555561
this.cdr.detectChanges();
556562
}
563+
564+
this.listDataLoaded.emit();
557565
}
558566

559567
private getColumnFilterExpressionsTree() {

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

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4213,6 +4213,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
42134213

42144214
it('Should correctly update all items based on \'SelectAll\' checkbox.', fakeAsync(() => {
42154215
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4216+
flush();
42164217

42174218
const visibleListItems = GridFunctions.getExcelStyleFilteringCheckboxes(fix);
42184219
const dataListItems = visibleListItems.slice(1, visibleListItems.length);
@@ -4245,6 +4246,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
42454246

42464247
it('Should correctly update all \'SelectAll\' checkbox when not a single item is checked.', fakeAsync(() => {
42474248
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Released');
4249+
flush();
42484250

42494251
const visibleListItems = GridFunctions.getExcelStyleFilteringCheckboxes(fix);
42504252
expect(visibleListItems.length).toBe(4);
@@ -4377,6 +4379,48 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
43774379
expect(listItems[3].innerText).toBe('custoM', 'incorrect list item label');
43784380
expect(listItems[4].innerText).toBe('custom', 'incorrect list item label');
43794381
}));
4382+
4383+
it('Should clear search criteria when selecting clear column filters option.', fakeAsync(() => {
4384+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4385+
4386+
let checkboxes = GridFunctions.getExcelStyleFilteringCheckboxes(fix);
4387+
fix.detectChanges();
4388+
4389+
checkboxes[0].click();
4390+
tick();
4391+
fix.detectChanges();
4392+
4393+
checkboxes[2].click();
4394+
tick();
4395+
fix.detectChanges();
4396+
4397+
GridFunctions.clickApplyExcelStyleFiltering(fix);
4398+
tick();
4399+
fix.detectChanges();
4400+
expect(grid.filteredData.length).toEqual(1);
4401+
4402+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4403+
flush();
4404+
4405+
let inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4406+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'Net', fix);
4407+
4408+
const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
4409+
expect(listItems.length).toBe(2, 'incorrect rendered list items count');
4410+
4411+
GridFunctions.clickClearFilterInExcelStyleFiltering(fix);
4412+
flush();
4413+
expect(grid.filteredData).toBeNull();
4414+
4415+
inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4416+
expect(inputNativeElement.value).toBe('', 'search criteria is not cleared');
4417+
4418+
checkboxes = GridFunctions.getExcelStyleFilteringCheckboxes(fix);
4419+
const listItemsCheckboxes = checkboxes.slice(1, checkboxes.length);
4420+
for (const checkbox of listItemsCheckboxes) {
4421+
ControlsFunction.verifyCheckboxState(checkbox.parentElement);
4422+
}
4423+
}));
43804424
});
43814425

43824426
describe('Templates: ', () => {
@@ -4527,6 +4571,23 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
45274571
GridSelectionFunctions.verifyColumnAndCellsSelected(columnId, false);
45284572

45294573
});
4574+
4575+
it('Should reset esf menu with templates on column change', fakeAsync(() => {
4576+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Downloads');
4577+
flush();
4578+
4579+
let inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4580+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 20, fix);
4581+
4582+
const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
4583+
expect(listItems.length).toBe(2, 'incorrect rendered list items count');
4584+
4585+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4586+
flush();
4587+
4588+
inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4589+
expect(inputNativeElement.value).toBe('', 'input value didn\'t reset');
4590+
}));
45304591
});
45314592

45324593
describe('Load values on demand', () => {
@@ -4740,7 +4801,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
47404801
GridSelectionFunctions.verifyColumnAndCellsSelected(columnId, false);
47414802

47424803
});
4743-
47444804
});
47454805
});
47464806

0 commit comments

Comments
 (0)