Skip to content

Commit 239b40e

Browse files
committed
fix(Filter): Fixed the number input in template
1 parent 05e237c commit 239b40e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/app/grid-filter-template/grid-filter-template.sample.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,23 @@ export class GridFilterTemplateSampleComponent implements OnInit {
492492
let value = input.value;
493493
switch (column.dataType) {
494494
case DataType.Number:
495+
value = Number.parseInt(value, 10);
495496
operand = IgxNumberFilteringOperand.instance().condition('equals');
496497
break;
497498
case DataType.Date:
498-
value = (value instanceof Date) ? value : new Date(value);
499+
value = value !== '' ? new Date(value) : null;
499500
operand = IgxDateFilteringOperand.instance().condition('equals');
500501
break;
501502
default:
502503
operand = IgxStringFilteringOperand.instance().condition('contains');
503504
break;
504505
}
505-
this.grid1.filter(column.field, value, operand, column.filteringIgnoreCase);
506+
507+
if (value && value !== '') {
508+
this.grid1.filter(column.field, value, operand, column.filteringIgnoreCase);
509+
} else {
510+
this.grid1.clearFilter(column.field);
511+
}
506512
}
507513

508514
public clearInput(input: any, column: any) {

0 commit comments

Comments
 (0)