Decimal separator InCell editing

2 posts, 0 answers
  1. Iwan van Ee
    Iwan van Ee avatar
    24 posts
    Member since:
    Dec 2009

    Posted 14 Nov 2016 Link to this post

    I have some prices to display and edit in a Kendo UI Grid.

    Prices ned to be shown (and edited) in nl-NL format. Prices are in double format.

    The grid show it like: € 12,34. With a comma as separator. This is the correct format.

    The I click on a cell to edit the price the edit cell display 12.34

    - no currency symbol, which is not the main issue but would be great if this is also possible)

    - displays with a point as decimal separator. When I change the value to 12.35 (with the same point separator as the edit box shows) it is stored as 1235.

    - I need to edit the point as well and make it 12,35 (with the comma as separator). This behaviour is right btw, because we always edit with the comma as separator.

    But the question is: 

    Why is the number displayed with a point as separator in the first place when I click on a cell. I need it there to display with the comma as a separator.

     

    My code looks like the following:

    ViewModel
     
    [DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
    [Display(Name = "Price")]
    public double? price { get; set; }
     
    .cshtml
     
    columns.Bound(c => c.price).Filterable(false).Width(100);
     
    @(Html.Kendo().Grid<PriceViewModel>()
    .Name("grid").AutoBind(false)
        .Columns(columns =>
        {
            columns.Bound(c => c.Id).Hidden();
    ...
            columns.Bound(c => c.price).Filterable(false).Width(100);
    ...
        })
    ...
        .Editable(e =>
        {
            e.Mode(GridEditMode.InCell);
            e.DisplayDeleteConfirmation(false);
        })
    ...
        .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(false)
            .PageSize(12)
            .Model(model => model.Id(c => c.Id))
            .Read(read => read.Action("Read", "MaterialByClass").Data("getClassname"))
            .Model(model =>
            {
                model.Id(p => p.Id);
                model.Field(p => p.code).Editable(false);
    ...
            }
            )
            .Update("Update", "MaterialByClass")
            .Destroy("Delete", "MaterialByClass")
         )
    )
     
    @section scripts
    {
        @Scripts.Render("~/bundles/jquery-cookie")
     
        <script type="text/javascript">
     
            $(document).ready(function () {
                kendo.culture("nl-NL");
    ...
            });
     
        </script>
     
    }
     
    Web.Config
     
      <system.web>
    ...
        <globalization culture="nl-NL" uiCulture="nl" enableClientBasedCulture="true" />
    ...
      </system.web>
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 16 Nov 2016 Link to this post

    Hello Iwan,

    Can you please ensure that you are adding the nl-NL script file:
    <script src="@Url.Content("~/Scripts/cultures/kendo.culture.nl-NL.min.js")"></script>

    You can refer to the following help article for detailed information on globalization:
    Hope this helps.


    Regards,
    Konstantin Dikov
    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