Skip to content

Commit 8e26b7b

Browse files
authored
Merge pull request #7096 from IgniteUI/dkamburov/fix-6973
fix(filtering): Avoid resetting values for number inputs #6973
2 parents 008bdd1 + e9fcc1f commit 8e26b7b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IBaseChipEventArgs, IgxChipsAreaComponent, IgxChipComponent } from '../
2424
import { ExpressionUI } from '../grid-filtering.service';
2525
import { IgxDropDownItemComponent } from '../../../drop-down/drop-down-item.component';
2626
import { IgxFilteringService } from '../grid-filtering.service';
27-
import { KEYS, isEdge } from '../../../core/utils';
27+
import { KEYS, isEdge, isIE } from '../../../core/utils';
2828
import { AbsoluteScrollStrategy } from '../../../services/overlay/scroll';
2929

3030
/**
@@ -262,8 +262,11 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
262262
public onInput(eventArgs) {
263263
// The 'iskeyPressed' flag is needed for a case in IE, because the input event is fired on focus and for some reason,
264264
// when you have a japanese character as a placeholder, on init the value here is empty string .
265-
if (isEdge() || this.isKeyPressed || eventArgs.target.value) {
266-
this.value = eventArgs.target.value;
265+
// There is no need to reset the value on every invalid number input.
266+
// The invalid value is converted to empty string input type="number"
267+
const target = eventArgs.target;
268+
if (isEdge() && target.type !== 'number' || this.isKeyPressed && isIE() || target.value) {
269+
this.value = target.value;
267270
}
268271
}
269272

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
229229

230230
expect(grid.rowList.length).toEqual(3);
231231
verifyFilterRowUI(input, close, reset, false);
232+
233+
// greater than or equal to with invalid value should not reset filter
234+
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
235+
GridFunctions.typeValueInFilterRowInput('254..', fix, input);
236+
237+
expect(grid.rowList.length).toEqual(3);
238+
verifyFilterRowUI(input, close, reset, false);
232239
}));
233240

234241
// UI tests boolean column

0 commit comments

Comments
 (0)