This is a migrated thread and some comments may be shown as answers.

Column editor template; textbox format option not working

3 Answers 557 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaan
Top achievements
Rank 1
Kaan asked on 30 Jan 2017, 04:51 PM

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

 

3 Answers, 1 is accepted

Sort by
0
Niko
Telerik team
answered on 01 Feb 2017, 05:58 PM

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.
0
Kaan
Top achievements
Rank 1
answered on 06 Feb 2017, 03:06 PM

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

0
Milena
Telerik team
answered on 08 Feb 2017, 11:41 AM
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.
Tags
Grid
Asked by
Kaan
Top achievements
Rank 1
Answers by
Niko
Telerik team
Kaan
Top achievements
Rank 1
Milena
Telerik team
Share this question
or