代码:
function directorsOrRecipients(e)
{
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
transport: {
read: { url: "http:...xxxx" + e.data.AwardTitleId, type: "GET" }
},
schema: {
model: {
id: "namefirstlast",
fields: {
"namefirstlast": { editable: true, type: "string" },
"directorsequence": { editable: true, type: "number" },
"isonballot": { editable: true, type: "boolean" },
"concatenation": { editable: true, type: "string" },
"MoreNames": { editable: true, type: "number" },
}
},
}
},
columns: [
{ field: "namefirstlast", title: "Name", editor: namesAutoComplete },
{ field: "directorsequence", title: "Director Sequence", format: "{0:n0}" },
{ field: "isonballot", title: "On ballot?" },
{ field: "concatenation", title: "Concatenation" },
{ field: "MoreNames", title: "More names?", format: "{0:n0}"},
{ command: ["edit"], title: " ", width: "100px" }],
sortable: true,
editable: "inline",
toolbar: [{ name: "create", text: "Add New Director/Recipient" }]
});
}
我想确保用户只能在 MoreNames 列上输入 0 或更大的数字。没有负数。
请注意,这个网格是由 Kendo 生成的,所以它不是我创建的简单 HTML 结构。
这是我关心的文本框的 DOM 对象:
<input type="text" name="MoreNames" data-type="number" data-bind="value:MoreNames" data-role="numerictextbox" role="spinbutton" class="k-input" aria-disabled="false" aria-readonly="false" style="display: none;">
我尝试选择此对象并添加“min”属性,但我无法选择它,这让我相信我选择不正确。
这是我尝试过的:
$("[name='MoreNames']").attr("min", "0");
有人可以帮我解决这个问题吗?