Skip to content

Commit 4758df1

Browse files
committed
fix(groupby): Resolves requested changes #5643
1 parent ee5d736 commit 4758df1

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

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

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -604,31 +604,6 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
604604
this.notifyChanges(true);
605605
}
606606

607-
/**
608-
* Checks whether `IgxColumnComponent` has an element without a `[field]`.
609-
* Supports both single instance of the `ISortingExpression` and an array of elements.
610-
* ```typescript
611-
* this.grid.checkIfNoField({ fieldName: name, dir: SortingDirection.Asc, ignoreCase: false });
612-
* this.grid.checkIfNoField([
613-
{ fieldName: name1, dir: SortingDirection.Asc, ignoreCase: false },
614-
{ fieldName: name2, dir: SortingDirection.Desc, ignoreCase: true },
615-
{ fieldName: name3, dir: SortingDirection.Desc, ignoreCase: false }
616-
]);
617-
* ```
618-
* @memberof IgxGridComponent
619-
*/
620-
public checkIfNoField(expression: IGroupingExpression | Array<IGroupingExpression> | any): boolean {
621-
if (expression instanceof Array) {
622-
for (const singleExpression of expression) {
623-
if (singleExpression.fieldName === undefined) {
624-
return true;
625-
}
626-
}
627-
return false;
628-
}
629-
return expression.fieldName === undefined;
630-
}
631-
632607
/**
633608
* Clears all grouping in the grid, if no parameter is passed.
634609
* If a parameter is provided, clears grouping for a particular column or an array of columns.
@@ -1020,4 +995,17 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
1020995
this.navigation.grid = this;
1021996
}
1022997
}
998+
999+
public checkIfNoField(expression: IGroupingExpression | Array<IGroupingExpression> | any): boolean {
1000+
if (expression instanceof Array) {
1001+
for (const singleExpression of expression) {
1002+
if (!singleExpression.fieldName) {
1003+
return true;
1004+
}
1005+
}
1006+
return false;
1007+
}
1008+
return !expression.fieldName;
1009+
}
1010+
10231011
}

projects/igniteui-angular/src/lib/grids/grid/grid.directives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class IgxGroupAreaDropDirective extends IgxDropDirective {
7878
}
7979
const grid = <IgxGridComponent>column.grid;
8080
const isGrouped = grid.groupingExpressions.findIndex((item) => item.fieldName === column.field) !== -1;
81-
if (column.groupable && !isGrouped && !column.columnGroup && column.field !== undefined) {
81+
if (column.groupable && !isGrouped && !column.columnGroup && !!column.field) {
8282
drag.icon.innerText = 'group_work';
8383
this.hovered = true;
8484
} else {
@@ -106,7 +106,7 @@ export class IgxGroupAreaDropDirective extends IgxDropDirective {
106106
}
107107
const grid = <IgxGridComponent>column.grid;
108108
const isGrouped = grid.groupingExpressions.findIndex((item) => item.fieldName === column.field) !== -1;
109-
if (column.groupable && !isGrouped && !column.columnGroup && column.field !== undefined) {
109+
if (column.groupable && !isGrouped && !column.columnGroup && !!column.field) {
110110
grid.groupBy({ fieldName: column.field, dir: SortingDirection.Asc, ignoreCase: column.sortingIgnoreCase,
111111
strategy: column.sortStrategy, groupingComparer: column.groupingComparer });
112112
}

0 commit comments

Comments
 (0)