我有一个需要显示折扣的剑道网格。我必须实现它应该接受 0.00 到 100 之间的数字的验证。我已经编写了接受 0 到 100 之间的数字的代码,现在我需要实现小数点后 2 位验证为出色地。请帮忙。
$(gridname).kendoGrid({
dataSource: {
data: data.ReportData,
schema: {
model: {
fields: {
ProposedDiscountNST: {format: "{0:n2}",
validation: {
required: true,
proposeddiscountNSTvalidation: function (input) {
if (input.val() != "" && input.is("[name='ProposedDiscountNST']")) {
input.attr("data-proposeddiscountNSTvalidation-msg", "Should be between 0.00 & 100");
// return input.val() >= 0 && input.val() < 101 && input.val() % 1 == 0;
return input.val() >= 0 && input.val() < 101 ; // Accepts max 2 decimal digits
} else {
return true;
}
}
}
}
我需要显示该字段仅接受 2 位小数的验证消息。请帮忙。

