我需要捕获用户在以下字段中输入的VALUE:
下面代码中的注释显示了我想要使用这些变量的位置。
我唯一不知道如何做的是如何在这两个字段中引用VALUE。我不知道是否有一种特定的方式我应该使用Kendo或尝试使用jquery。
例如,如果我检查元素concatenationString,这就是我所看到的:
<input type="text" class="k-input k-textbox" name="concatenation" data-bind="value:concatenation">
这是网格定义:
function directorsOrRecipients(e)
{
$("<div/>").appendTo(e.detailCell).kendoGrid({
reorderable: true,
resizable: true,
dataSource: {
transport: {
read: {
url: "http://localhost/x/api/Awards/directors/" + e.data.AwardTitleId,
type: "GET"
},
create: {
url: "http://localhost/x/api/awards/directors",
type: "POST",
data: {
awardTitleId: e.data.AwardTitleId,
personId: localStorage.personId,
nameId: localStorage.nameId,
isOnBallot: "True",//I need to get this value based on the user input.,
concatenationString: "test1",//I need to get this value based on the user input.
whoEntered: 0
}
}
},
schema: {
model: {
id: "namefirstlast",
fields: {
"namefirstlast": { editable: true, type: "string" },
"directorsequence": { editable: true, type: "number", validation: { min: 1 } },
"isonballot": { editable: true, type: "boolean" },
"concatenation": { editable: true, type: "string" },
"MoreNames": {
editable: true,
type: "number",
validation: { min: 0 }
},
},
},
}
},
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: 100 }],
sortable: true,
sort: { field: "namefirstlast", dir: "desc" },
editable: "inline",
toolbar: [{
name: "create",
text: "Add New Director/Recipient"
}]
});
}
任何人都可以帮我一把?
谢谢!
答案 0 :(得分:0)
终于搞清楚了。
通过这样做,您可以从内联编辑的单元格中获取值:
save: function(a)
{
var value = a.model.Item;
}
以下是整个代码:
save: function(a)
{
directorData["Operation"] = "I";
if (!a.model.isNew())
{
directorData["AwardTitleId"] = awardTitleId;
directorData["PersonId"] = a.model.PersonId;
directorData["NameId"] = a.model.NameId;
directorData["Operation"] = "U";
}
if (a.model.IsOnBallot == true)
{
ballot = 1;
}
if (a.model.IsOnBallot == false)
{
ballot = 0;
}
directorData["DirectorSequence"] = a.model.DirectorSequence;
directorData["IsOnBallot"] = ballot;
directorData["Concatenation"] = a.model.Concatenation;
$.ajax({
url: "http://localhost/Take3/api/awards/directors",
type: "POST",
dataType: "json",
data: directorData
}).done(function()
{
detailRow.find(".directorsOrRecipients").data("kendoGrid").dataSource.read();
detailRow.find(".directorsOrRecipients").data("kendoGrid").refresh();
});
},