Kiren S
Kiren S

Reputation: 3097

Formatting kendo numeric text box

I have a kendo numeric box in grid. Only numbers are allowed in it. No decimal places and no comma separators. I tried in different ways but did not succeeded. Any idea ... Please help me...

In data source fields i given like this

seq_no  : {type: "number",validation: {min: 1,max: 32767}}

In column of grid

{ field: "seq_no", width: "50px", title: "Sequence Number", type:"number"}

Upvotes: 17

Views: 45289

Answers (4)

Ivan Ananjev
Ivan Ananjev

Reputation: 1

format: "{#.##}"

This one removes grouping together with decimal separator

Upvotes: 0

Houdini Sutherland
Houdini Sutherland

Reputation: 1570

For some reason:

format: "{0:n0}"

does not always get rid of the seperator. But I find that:

format: "{0:#.##}"

works nicely on the model field.

Hope this helps someone.

Upvotes: 5

Kiren S
Kiren S

Reputation: 3097

Above mentioned answer is working, but it allows to enter decimal points. But this solution I implemented not allow a user to enter decimal points in text box

{ field: "seq_no",width: "10px", title: "Sequence Number",
    editor: function(container, options) { 
            $('<input  maxlength="5"  name="' + options.field + '"/>')
             .appendTo(container)
             .kendoNumericTextBox({
               min:0,
               max: 32767,
               format:"#",
               decimals:0
             })
        }
}

Upvotes: 16

OnaBai
OnaBai

Reputation: 40897

Use format with value {0:n0}:

{ field: "seq_no", width: "50px", title: "Sequence Number", type:"number", format: "{0:n0}" }

Upvotes: 17

Related Questions