Is it possible to restrict a Numeric Input Column to accept decimal?

1 Answer 771 Views
Grid
Soumita
Top achievements
Rank 1
Soumita asked on 30 Nov 2022, 11:14 AM

Hi,

I have a numeric input cell in a grid which should accept only integer.

Is it possible to restrict user from entering decimal values?

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 02 Dec 2022, 08:02 AM

Hi Soumita,

Тhank you for contacting us.

There are two ways for achieving the desired result.

The first one would be to define custom editor for the column in question and use a NumericTextBox with format "n0", which will restrict the value to have no decimals:

 <NumericTextBox width={200} format="n0"  />

And here is a help topic for defining custom editor:

Another option would be to use PropsContext and wrap the Grid in NumericTextBoxPropsContext to change the properties of all instances within the Grid:

The second approach is more suitable if you want to restrict the decimals for all NumericTextBox components inside the Grid.

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Soumita
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or