Skip to content

Commit

Permalink
Merge pull request #7096 from IgniteUI/dkamburov/fix-6973
Browse files Browse the repository at this point in the history
fix(filtering): Avoid resetting values for number inputs #6973
  • Loading branch information
ChronosSF authored Apr 14, 2020
2 parents 008bdd1 + e9fcc1f commit 8e26b7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { IBaseChipEventArgs, IgxChipsAreaComponent, IgxChipComponent } from '../
import { ExpressionUI } from '../grid-filtering.service';
import { IgxDropDownItemComponent } from '../../../drop-down/drop-down-item.component';
import { IgxFilteringService } from '../grid-filtering.service';
import { KEYS, isEdge } from '../../../core/utils';
import { KEYS, isEdge, isIE } from '../../../core/utils';
import { AbsoluteScrollStrategy } from '../../../services/overlay/scroll';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {

expect(grid.rowList.length).toEqual(3);
verifyFilterRowUI(input, close, reset, false);

// greater than or equal to with invalid value should not reset filter
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
GridFunctions.typeValueInFilterRowInput('254..', fix, input);

expect(grid.rowList.length).toEqual(3);
verifyFilterRowUI(input, close, reset, false);
}));

// UI tests boolean column
Expand Down

0 comments on commit 8e26b7b

Please sign in to comment.