Column editor template; textbox format option not working

4 posts, 0 answers
  1. Kaan
    Kaan avatar
    46 posts
    Member since:
    May 2016

    Posted 30 Jan 2017 Link to this post

    Hello!

    I have this editor template: @Html.Kendo().TextBoxFor(model => model).Format("{0:n3}")

    When I use this editor template to create a form, the numbers get formatted according to the format string with three decimal digits.

    But when I use the editor template for a grid column (in-cell / batch editing), the format option is ignored. Instead, numbers are shown exactly the way they are delivered from the server.

    However, grid client templates work perfectly:
    columnTest.Format("{0:n3}"); // or
    columnTest.ClientTemplate("#: kendo.toString('columnTest', 'n3') #");

    How can I configure the numeric formatting of the editor templates?

     

    Best regards,

    Kaan

     

  2. Niko
    Admin
    Niko avatar
    404 posts

    Posted 01 Feb 2017 Link to this post

    Hello Kaan,

    Could you, please, investigate what kind of kendo widget gets initialized as the editor for that column when the grid enters edit mode?

    Regards,
    Niko
    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.
  3. Kaan
    Kaan avatar
    46 posts
    Member since:
    May 2016

    Posted 06 Feb 2017 in reply to Niko Link to this post

    Hello Niko,

    I want to format this value: 48.197714

    I am using the following EditorTemplate, both for the form and the grid view:
    @model object
    @Html.Kendo().TextBoxFor(model => model).Format("{0:n3}")

    In the form the display value is 48,198. The widget is <input class="k-textbox" id="c5" name="c5" value="48,198">

    In the grid, the display value when edit mode is entered is 48.197714. The widget is <input class="k-textbox" id="c5" name="c5" data-bind="value:c5">. Both, the de-AT culture and the format (three decimals) is being ignored. I think, that the format option is somehow bypassed, when the grid binds the model data (remote data source) to the editor widget.

    Best regards,
    Kaan

  4. Milena
    Admin
    Milena avatar
    257 posts

    Posted 08 Feb 2017 Link to this post

    Hello,

    I would recommend you to use Number EditorTemplate from the provided editor templates in our package.

    Number editor template uses KendoNumericTextBox component, which is most appropriate for number type of values. See this help article.
    In case, you want to add your own editor template, you should add it to the same folder(EditorTemplates).

    Additionally, you can see how to change the culture here.

    Regards,
    Milena
    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