Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h4 class="ig-typography__h6">
<div class="igx-excel-filter__cancel">
<button type="button"
igxButton="flat"
(click)="closeDialog()">
(click)="cancelDialog()">
{{ grid.resourceStrings.igx_grid_excel_cancel }}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { IgxOverlayService } from '../../../services/overlay/overlay';
import { IgxIconComponent } from '../../../icon/icon.component';
import { IgxButtonDirective } from '../../../directives/button/button.directive';
import { NgClass, NgIf, NgFor } from '@angular/common';
import { BaseFilteringComponent } from './base-filtering.component';

/**
* @hidden
Expand Down Expand Up @@ -96,6 +97,7 @@ export class IgxExcelStyleCustomDialogComponent implements AfterViewInit {
protected overlayService: IgxOverlayService,
private cdr: ChangeDetectorRef,
protected platform: PlatformUtil,
public esf: BaseFilteringComponent
) { }

public ngAfterViewInit(): void {
Expand Down Expand Up @@ -151,6 +153,11 @@ export class IgxExcelStyleCustomDialogComponent implements AfterViewInit {
}
}

public cancelDialog() {
this.esf.cancel();
this.closeDialog();
}

public onApplyButtonClick() {
this.expressionsList = this.expressionsList.filter(
element => element.expression.condition &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7012,6 +7012,29 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {

}));

it('should discard filters through esf menu properly on cancel button click', fakeAsync(() => {
grid.filter('ProductName', 'Ignite', IgxStringFilteringOperand.instance().condition('contains'));
fix.detectChanges();

expect(fix.debugElement.nativeElement.querySelector('.igx-excel-filter__filter-number').textContent).toContain('(1)');
expect(grid.filteredData.length).toEqual(2);
tick(200);
fix.detectChanges();

GridFunctions.clickExcelFilterCascadeButton(fix);
tick();
fix.detectChanges();

GridFunctions.clickOperatorFromCascadeMenu(fix, 0);
tick(100);
fix.detectChanges();
GridFunctions.setOperatorESF(fix, 1, 0);
GridFunctions.setInputValueESF(fix, 1, 'Angular');
GridFunctions.clickCancelExcelStyleCustomFiltering(fix);

expect(fix.debugElement.nativeElement.querySelector('.igx-excel-filter__filter-number').textContent).toContain('(1)');
expect(grid.filteredData.length).toEqual(2);
}));
});
});

Expand Down
Loading