Skip to content

Commit 0a45591

Browse files
committed
fix(grid): handle null values in filerVaues list #8562
1 parent 2bd6573 commit 0a45591

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
451451
}
452452

453453
for (let index = 0; index < this.uniqueValues.length; index++) {
454-
const element = this.uniqueValues[index];
455-
const value = this.column.dataType === DataType.Date && element.value ? new Date(element.value).toISOString() : element.value;
454+
const value = this.getExpressionValue(this.uniqueValues[index]);
456455
if (this.filterValues.has(value)) {
457456
return true;
458457
}
@@ -644,8 +643,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
644643
filterListItem.isFiltered = false;
645644

646645
if (shouldUpdateSelection) {
647-
const value = this.column.dataType === DataType.Date && element.value ?
648-
new Date(element.value).toISOString() : element.value;
646+
const value = this.getExpressionValue(element);
649647
if (this.filterValues.has(value)) {
650648
filterListItem.isSelected = true;
651649
filterListItem.isFiltered = true;
@@ -740,6 +738,16 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
740738
return element;
741739
}
742740

741+
private getExpressionValue(element: any): string {
742+
let value;
743+
if (this.column.dataType === DataType.Date) {
744+
value = element && element.value ? new Date(element.value).toISOString() : element.value;
745+
} else {
746+
value = element;
747+
}
748+
return value;
749+
}
750+
743751
// TODO: sort members by access modifier
744752

745753
/**

0 commit comments

Comments
 (0)