Skip to content

Commit 6ff0fbe

Browse files
authored
Merge pull request #7021 from IgniteUI/nrobakova/fix-issue-7004
Update filter cell style when column is selected
2 parents c105ddb + 2563f59 commit 6ff0fbe

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@
508508
@extend %igx-grid__filtering-cell !optional;
509509
}
510510

511+
@include e(filtering-cell, $m: 'selected') {
512+
@extend %igx-grid__filtering-cell !optional;
513+
@extend %igx-grid__filtering-cell--selected !optional;
514+
}
515+
511516
@include e(filtering-cell-indicator) {
512517
@extend %igx-grid__filtering-cell-indicator !optional;
513518
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@
10741074
border-bottom: none;
10751075
}
10761076

1077-
%igx-grid__tr--pinned {
1077+
%igx-grid__tr--pinned {
10781078
position: relative;
10791079
background: inherit;
10801080
z-index: 10000;
@@ -2207,6 +2207,11 @@
22072207
}
22082208
}
22092209

2210+
%igx-grid__filtering-cell--selected {
2211+
color: --var($theme, 'row-selected-text-color');
2212+
background: --var($theme, 'row-selected-cell-background');
2213+
}
2214+
22102215
%igx-grid__filtering-cell-indicator {
22112216
position: relative;
22122217
display: flex;

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,15 @@ export class IgxGridFilteringCellComponent implements AfterViewInit, OnInit, DoC
5959
@ViewChild('complexChip', { read: IgxChipComponent })
6060
protected complexChip: IgxChipComponent;
6161

62-
@HostBinding('class.igx-grid__filtering-cell')
63-
public cssClass = 'igx-grid__filtering-cell';
62+
63+
@HostBinding('class')
64+
get styleClasses(): string {
65+
if (this.column && this.column.selected) {
66+
return 'igx-grid__filtering-cell--selected';
67+
}
68+
69+
return 'igx-grid__filtering-cell';
70+
}
6471

6572
constructor(public cdr: ChangeDetectorRef, public filteringService: IgxFilteringService) {
6673
this.filteringService.subscribeToEvents();

projects/igniteui-angular/src/lib/grids/grid/column-selection.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { ɵɵsetComponentScope } from '@angular/core';
1212

1313
const SELECTED_COLUMN_CLASS = 'igx-grid__th--selected';
1414
const SELECTED_COLUMN_CELL_CLASS = 'igx-grid__td--column-selected';
15+
const SELECTED_FILTER_CELL_CLASS = 'igx-grid__filtering-cell--selected';
16+
1517
function selectedData() {
1618
return [{ ProductID: 1, ProductName: 'Chai' },
1719
{ ProductID: 2, ProductName: 'Aniseed Syrup' },
@@ -766,11 +768,15 @@ describe('IgxGrid - Column Selection #grid', () => {
766768

767769
it('Filtering: Verify column selection when filter row is opened ', fakeAsync(() => {
768770
grid.allowFiltering = true;
771+
fix.detectChanges();
772+
const filterCell = GridFunctions.getFilterCell(fix , 'ProductID');
773+
expect(filterCell.nativeElement.classList.contains(SELECTED_FILTER_CELL_CLASS)).toBeFalsy();
769774
const colInStock = grid.getColumnByName('InStock');
770775
colProductID.selected = true;
771776
fix.detectChanges();
772777

773-
GridFunctions.clickFilterCellChipUI(fix, 'ProductName'); // Name column contains nested object as a value
778+
expect(filterCell.nativeElement.classList.contains(SELECTED_FILTER_CELL_CLASS)).toBeTruthy();
779+
GridFunctions.clickFilterCellChipUI(fix, 'InStock'); // Name column contains nested object as a value
774780
tick(150);
775781
fix.detectChanges();
776782

0 commit comments

Comments
 (0)