Hello,
I am using Igx-data Grid. I have column for combination of string and number datatype.
I want to write few validations for the number column mentioned below:
1. restrict the column to max 99999.
2. Column should only allow numbers(no alphabets) . It is allowing e now.
3. No ',' should be allowed.
Hope to hear reply soon.
Thanks.
No, you cannot restrict data entry using formatter function.
I suggest you use onCellEdit event to perform data validation. For more details about how to implement validation on the edit event, please take a look at the document below.
https://ko.infragistics.com//angularsite/components/grid/editing.html#cell-validation-on-edit-event
One more thing can i achieve 1,2 of my question using column formatter. If yes, can you provide snippet please
Thank you so much Mihoko!! It worked :)
Can you please try the following?
------------onColumnInit(column: IgxColumnComponent) { if(column.field =="your_field_key") { column.formatter = (a => { return a.toString().replace(/\,/g,''); }); }}------------
If the above does not work, can you possibly send a sample that reproduces your problem?
i used the same formatter, but not able to remove commas from the column. Can u share the code snippet what logic removes commas from the igx column for number data type.
Thanks