Skip to content

Commit 18de483

Browse files
authored
Merge pull request #8584 from IgniteUI/ibarakov/fix-8463-9.1.x
fix(esf): allow only numeric symbols in numeric column
2 parents 7537989 + f4b7cbd commit 18de483

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-search.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
tabindex="0"
99
[(ngModel)]="searchValue"
1010
[placeholder]="column.grid.resourceStrings.igx_grid_excel_search_placeholder"
11+
[type]="type"
1112
autocomplete="off"/>
1213
<igx-icon
1314
igxSuffix

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { DisplayDensity } from '../../../core/density';
1515
import { IgxForOfDirective } from '../../../directives/for-of/for_of.directive';
1616
import { FilterListItem } from './grid.excel-style-filtering.component';
1717
import { IgxListComponent } from '../../../list/public_api';
18+
import { DataType } from '../../../data-operations/data-util';
1819

1920
@Directive({
2021
selector: '[igxExcelStyleLoading]'
@@ -86,6 +87,18 @@ export class IgxExcelStyleSearchComponent implements AfterViewInit {
8687

8788
constructor(public cdr: ChangeDetectorRef) { }
8889

90+
/**
91+
* @hidden @internal
92+
*/
93+
public get type(): string {
94+
switch (this.column?.dataType) {
95+
case DataType.Number:
96+
return 'number';
97+
default:
98+
return 'text';
99+
}
100+
}
101+
89102
public ngAfterViewInit() {
90103
this.refreshSize();
91104
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4412,6 +4412,15 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
44124412
checkboxes = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix));
44134413
expect(checkboxes.every(ch => ch.checked)).toBeTrue();
44144414
}));
4415+
4416+
it('Should have input type number when column dataType is number.', fakeAsync(() => {
4417+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Downloads');
4418+
flush();
4419+
4420+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4421+
expect(inputNativeElement.type).toBe('number', 'input type of number column is not number');
4422+
4423+
}));
44154424
});
44164425

44174426
describe(null, () => {

0 commit comments

Comments
 (0)