Nitheesh Nitheesh - 1 year ago 124
jQuery Question

How to set the decimal places of a number in Kendo UI model defenition?

I'm using a kendo ui editable grid with

. Usually in
the decimal places are limited to two i.e, if I enter 10.135 the value will be formatted to 10.14. But what I need is to get 10.135 itself. What is to be done here.

My model definition.

var GridViewModel = new{
fields: {
Name: { type: "string", editable: false },
Weight: { type: "number", editable: true, validation: { required: true } },

and in my view model I have set the Grid as.

dataSource: {
data: DataDetails,
schema: {
model: GridViewModel
editable: true,
dataBound: function () {

columns: [
field: "Name",
title: "Name"
field: "Weight",
title: "Total Weight"

I have not mentioned my failed attempts in this example. Currently my
field is a numeric text box with two fields. What is to be done here to make my
field a NumericTextBox with 3 decimal point.

Answer Source

In order to control the configuration of the NumericTextBox used by the grid as the editor, you need to implement a custom editor, otherwise, the default configuration for the NumericTextBox will be used(which is 2 decimal places).

Try changing your "Weight" column definition to:

    field: "Weight",
    title: "Total Weight",
    editor: weightEditor

and add a weightEditor function that implements the custom editor:

function weightEditor(container, options) {
    $('<input name="' + options.field + '"/>')
         decimals: 3,


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download