Skip to content

Commit

Permalink
feat(*): show already applied filter operands in filter dialog #14188
Browse files Browse the repository at this point in the history
  • Loading branch information
ddincheva committed Jun 10, 2024
1 parent db46f9e commit 450cb2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,18 @@ export class IgxExcelStyleCustomDialogComponent implements AfterViewInit {

private createInitialExpressionUIElement() {
if (this.expressionsList.length == 1) {
const currentExpr = this.expressionsList[0].expression;
if (currentExpr.condition.name === this.selectedOperator) {
const currentExprUI = this.expressionsList.pop();
if (currentExprUI.expression.condition.name === this.selectedOperator) {
currentExprUI.beforeOperator = FilteringLogic.And;
const secondExprUI = new ExpressionUI();
secondExprUI.expression = {
condition: null,
fieldName: this.column.field,
ignoreCase: this.column.filteringIgnoreCase,
searchVal: null
};

secondExprUI.beforeOperator = FilteringLogic.And;

currentExprUI.afterOperator = FilteringLogic.And;
this.expressionsList.push(currentExprUI);
this.expressionsList.push(secondExprUI);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
}

public get filterIconClassName() {
return this.column.filteringExpressionsTree ? 'igx-excel-filter__icon--filtered' : 'igx-excel-filter__icon';
return this.column.filteringExpressionsTree || this.isAdvancedFilterApplied() ? 'igx-excel-filter__icon--filtered' : 'igx-excel-filter__icon';
}

public get selectable() {
Expand Down Expand Up @@ -276,6 +276,13 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
this.sortDirection = expr ? expr.dir : SortingDirection.None;
}

protected isAdvancedFilterApplied() {
if(!this.grid.advancedFilteringExpressionsTree) {
return false;
}
return !!this.grid.advancedFilteringExpressionsTree.find(this.column.field);
}

private triggerSort() {
const groupingExpr = this.grid.groupingExpressions ?
this.grid.groupingExpressions.find((expr) => expr.fieldName === this.column.field) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<ng-content></ng-content>
</span>
<span *ngIf="!ref.childNodes.length">{{ grid?.resourceStrings.igx_grid_toolbar_advanced_filtering_button_label }}</span>
<span *ngIf="grid?.advancedFilteringExpressionsTree"> ({{ grid?.advancedFilteringExpressionsTree.filteringOperands.length}}) </span>
</button>

0 comments on commit 450cb2c

Please sign in to comment.