Reputation: 9970
Code:
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" }]
});
}
I want to make sure the user can only enter numbers that are 0 or greater on the MoreNames column. No negative numbers.
Please note, this grid gets generated by Kendo so it's not a simple HTML structure that I created.
This is the DOM object for the text box I'm concerned with:
<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;">
I tried selecting this object and adding an attribute of "min" but I cannot select it which leads me to believe I'm selecting it incorrectly.
This is what I tried:
$("[name='MoreNames']").attr("min", "0");
Can someone give me a hand on this?
Upvotes: 2
Views: 4917
Reputation: 9970
I figured it out:
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", validation: { min: 0 } },
}
},
}
},
Upvotes: 8