I want to create a format for NumericTextBox for numbers like “1 000 000,00”. I use Kendo with ASP.NET MVC and I don’t understand how change thousand separator like comma to a white space. There is my code for specific class in javascript.
Code: strong text
$("#XXXXXX").kendoNumericTextBox({
format: "# #",
decimals: 0,
min: 0,
max: 9999,
spinners: false,
value: XXXXXXXX
}).addClass("nombre").attr('maxlength', '4');
I hope that you can help me. Thank you very much.
The decimal separator and the group separator come from the current kendo culture and they can not be set directly to the kendoNumericTextBox
as options. However you can change the corresponding culture values, but be careful because this may affect other kendo widgets too.
Here is an example:
// Setting the string that separates the number groups
kendo.cultures.current.numberFormat[","] = ' ';
// Setting the string that separates a number from the fractional point
kendo.cultures.current.numberFormat["."] = ',';
$('#myInput').kendoNumericTextBox();
And here is a JsFiddle Demo
Note: you can create custom kendo culture and pass it the kendo numeric by name - $('#input').kendoNumericTextBox({ culture: 'custom' });