KendoUI Grid Decimal number column

无人久伴 提交于 2019-12-03 01:42:35

Several questions (afaik):

  1. Format in columns is not defined as n4 but as {0:n4}.
  2. Formats are not just for the format of the number but might also include some text. Ex: {0:n4} Kg.
  3. For numeric columns, is not possible to specify attributes as decimals, step so you should define an editor function.

In addition, I don't understand your problems with decimals and round.

What I suggest is define the columns as:

{
    field: "weight",
    title: "Weight",
    width: 40,
    editor: numberEditor,
    format: '{0:n3} Kg.'
}

(assuming that you want three decimal precision) and define numberEditor as:

function numberEditor(container, options) {
    $('<input name="' + options.field + '"/>')
            .appendTo(container)
            .kendoNumericTextBox({
                format  : "{0:n3}",
                decimals: 3,
                step    : 0.001
            });
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!