当尝试将剑道微调器与 knockout 绑定(bind)一起使用时,我提供了属性“小数”并将其设置为“0”。我希望不显示小数点,也不允许小数点。 The problem is, when I use the spinner I get no decimals, but when the value is selected the displayed number defaults back to a 2 decimal display.我想使用它,但我不能,除非我能够将显示和输入限制为仅整数。有没有人对同样的问题有任何经验?
data-bind="kendoNumericTextBox: { value: UnpaidMinuteDuration, min: 0,
max: 480, step: 5, decimals: 0 }"
最佳答案
设置decimals
属性是不够的,因为它只控制“输入模式”。
要同时更改您的值的显示方式,您需要设置 format
property到 string format不显示小数:
data-bind="kendoNumericTextBox: {
value: UnpaidMinuteDuration,
min: 0,
max: 480,
step: 5,
decimals: 0,
format: '0.' }"
演示 JSFiddle .
关于knockout.js - 将 Kendo UI 微调器限制为没有小数的整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21288360/