Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(filtering): Avoid resetting values for number inputs #6973 #7097

Merged
merged 2 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -281,8 +281,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