Skip to content

Commit eb1b99e

Browse files
authored
Merge branch '8.2.x' into add-paginator-migrations
2 parents fd59d39 + 161b166 commit eb1b99e

File tree

5 files changed

+55
-5
lines changed

5 files changed

+55
-5
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
477477

478478
this.filteringService.filteredColumn = null;
479479
this.filteringService.selectedExpression = null;
480-
this.cdr.detectChanges();
481480

482481
this.chipAreaScrollOffset = 0;
483482
this.transform(this.chipAreaScrollOffset);

projects/igniteui-angular/src/lib/grids/grid-base.component.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
10731073
*/
10741074
set filterMode(value) {
10751075
this._filterMode = value;
1076+
1077+
if (this.filteringService.isFilterRowVisible) {
1078+
this.filteringRow.close();
1079+
}
1080+
this.notifyChanges(true);
10761081
}
10771082

10781083
/**
@@ -4446,6 +4451,17 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
44464451
return pagingHeight;
44474452
}
44484453

4454+
/**
4455+
* @hidden
4456+
*/
4457+
protected getFilterCellHeight(): number {
4458+
const headerGroupNativeEl = (this.headerGroupsList.length !== 0) ?
4459+
this.headerGroupsList[0].element.nativeElement : null;
4460+
const filterCellNativeEl = (headerGroupNativeEl) ?
4461+
headerGroupNativeEl.querySelector('igx-grid-filtering-cell') : null;
4462+
return (filterCellNativeEl) ? filterCellNativeEl.offsetHeight : 0;
4463+
}
4464+
44494465
/**
44504466
* @hidden
44514467
*/
@@ -4454,12 +4470,14 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
44544470
return null;
44554471
}
44564472

4457-
4473+
const actualTheadRow = (!this.allowFiltering || (this.allowFiltering && this.filterMode !== FilterMode.quickFilter)) ?
4474+
this.theadRow.nativeElement.offsetHeight - this.getFilterCellHeight() :
4475+
this.theadRow.nativeElement.offsetHeight;
44584476
const footerHeight = this.summariesHeight || this.tfoot.nativeElement.offsetHeight - this.tfoot.nativeElement.clientHeight;
44594477
const toolbarHeight = this.getToolbarHeight();
44604478
const pagingHeight = this.getPagingHeight();
44614479
const groupAreaHeight = this.getGroupAreaHeight();
4462-
const renderedHeight = toolbarHeight + this.theadRow.nativeElement.offsetHeight +
4480+
const renderedHeight = toolbarHeight + actualTheadRow +
44634481
footerHeight + pagingHeight + groupAreaHeight +
44644482
this.scr.nativeElement.clientHeight;
44654483

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3421,6 +3421,34 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
34213421
tick(100);
34223422
expect(chip.componentInstance.selected).toBeTruthy();
34233423
}));
3424+
3425+
it('Should close filterRow when changing filterMode from \'quickFilter\' to \'excelStyleFilter\'', (async () => {
3426+
GridFunctions.clickFilterCellChip(fix, 'ProductName');
3427+
fix.detectChanges();
3428+
3429+
// Add a condition chip without submitting it.
3430+
GridFunctions.typeValueInFilterRowInput('a', fix);
3431+
await wait(16);
3432+
3433+
// Change filterMode to 'excelStyleFilter`
3434+
grid.filterMode = FilterMode.excelStyleFilter;
3435+
fix.detectChanges();
3436+
3437+
// Verify the the filterRow is closed.
3438+
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
3439+
expect(filterUIRow).toBeNull('filterRow is visible');
3440+
3441+
// Verify the ESF icons are visible.
3442+
const gridNativeElement = fix.debugElement.query(By.css('igx-grid')).nativeElement;
3443+
const thead = gridNativeElement.querySelector('.igx-grid__thead-wrapper');
3444+
const filterIcons = thead.querySelectorAll('.igx-excel-filter__icon');
3445+
expect(filterIcons.length).toEqual(4, 'incorrect esf filter icons count');
3446+
3447+
// Verify the condition was submitted.
3448+
const header = GridFunctions.getColumnHeader('ProductName', fix);
3449+
const activeFilterIcon = header.nativeElement.querySelector('.igx-excel-filter__icon--filtered');
3450+
expect(activeFilterIcon).toBeDefined('no active filter icon was found');
3451+
}));
34243452
});
34253453
describe(null, () => {
34263454
let fix, grid;
@@ -3629,6 +3657,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36293657
let fix, grid;
36303658
beforeEach(fakeAsync(() => {
36313659
fix = TestBed.createComponent(IgxGridFilteringComponent);
3660+
fix.detectChanges();
36323661
grid = fix.componentInstance.grid;
36333662
grid.filterMode = FilterMode.excelStyleFilter;
36343663
fix.detectChanges();

projects/igniteui-angular/src/lib/grids/grid/grid-mrl-keyboard-nav.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,8 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
30723072
grid.navigateTo(10, col.visibleIndex);
30733073
await wait(DEBOUNCETIME);
30743074
fix.detectChanges();
3075+
await wait(DEBOUNCETIME);
3076+
fix.detectChanges();
30753077

30763078
// cell should be at right edge of grid
30773079
cell = grid.getCellByColumn(10, 'City');
@@ -3085,6 +3087,8 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
30853087
grid.navigateTo(10, col.visibleIndex);
30863088
await wait(DEBOUNCETIME);
30873089
fix.detectChanges();
3090+
await wait(DEBOUNCETIME);
3091+
fix.detectChanges();
30883092

30893093
// cell should be at left edge of grid
30903094
cell = grid.getCellByColumn(10, 'CompanyName');
@@ -3099,6 +3103,8 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
30993103
grid.navigateTo(9, col.visibleIndex);
31003104
await wait(DEBOUNCETIME);
31013105
fix.detectChanges();
3106+
await wait(DEBOUNCETIME);
3107+
fix.detectChanges();
31023108

31033109
// cell should be at right edge of grid
31043110
cell = grid.getCellByColumn(9, 'ID');

src/app/grid-filtering/grid-filtering.sample.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ export class GridFilteringComponent implements OnInit, AfterViewInit {
534534
const filterMode = this.filterModes[event.index].value as FilterMode;
535535
if (filterMode !== this.grid1.filterMode) {
536536
this.grid1.filterMode = filterMode;
537-
this.grid1.reflow();
538537
}
539538
}
540539

@@ -552,6 +551,5 @@ export class GridFilteringComponent implements OnInit, AfterViewInit {
552551

553552
public onAllowFilteringChanged(event: IChangeCheckboxEventArgs) {
554553
this.grid1.allowFiltering = event.checked;
555-
this.grid1.reflow();
556554
}
557555
}

0 commit comments

Comments
 (0)