Locale agnostic numeric validation in grid

2 posts, 0 answers
  1. Jane
    Jane avatar
    15 posts
    Member since:
    Oct 2016

    Posted 25 Jan 2017 Link to this post


    I'm using Kendo UI for JSP and I have the following definition in my database schema model for a grid:

    <kendo:dataSource-schema-model-field name="density" type="string" >
             <kendo:dataSource-schema-model-field-validation required="true" min="0" pattern="\d{0,8}(\.\d{1,4})?" />


    Obviously this is only going to work if a . (full stop) is used as the decimal point.  However, my application is going to be deployed in multiple countries so I need a locale agnostic solution.

    In plain html5 I can have an input type="number" and use the step attribute to control the number of decimal places.  However, if I use type="number" in a grid then Kendo UI renders it as a NumericTextBox and I can't see how to set the number of decimal places.  (It defaults to 2 and I need 4). 

    I don't want my input field to be rendered as a NumericTextBox but I want to be able to validate it as a valid numeric whatever the locale.  Could you please tell me how to achieve this?   

  2. Ianko
    Ianko avatar
    1956 posts

    Posted 27 Jan 2017 Link to this post

    Hello Jane,

    In your case, I would rather suggest using the number type and customize the editor of the field. You can see how here: http://demos.telerik.com/jsp-ui/grid/editing-custom. That will enable you to further configure the NumericTextBox with the decimals option and optionally, culture option.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top