如何将AJAX GET调用的结果绑定到剑道网格?
请参阅下面的AJAX done函数中的注释:如何将AJAX GET调用的结果绑定到剑道网格?,ajax,kendo-grid,Ajax,Kendo Grid,请参阅下面的AJAX done函数中的注释: $("<div/>").appendTo(e.detailCell).kendoGrid({ reorderable: true, resizable: true, dataSource: { transport: { read: function() { $.aj
$("<div/>").appendTo(e.detailCell).kendoGrid({
reorderable: true,
resizable: true,
dataSource: {
transport: {
read: function()
{
$.ajax({
url: "http://x/y/api/Awards/directors/" + e.data.AwardTitleId,
type: "GET"
}).done(function()
{
//I'm not sure what to do here in order to bind the data returned by the GET to the grid.
});
},
},
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" }]
});
$(“”).appendTo(e.detailCell).kendoGrid({
可重定额:对,
可调整大小:正确,
数据源:{
运输:{
读:函数()
{
$.ajax({
url:“http://x/y/api/Awards/directors/“+e.data.AwardTitleId,
键入:“获取”
}).done(函数()
{
//为了将GET返回的数据绑定到网格,我不确定在这里应该做什么。
});
},
},
模式:{
型号:{
id:“namefirstlast”,
字段:{
“namefirstlast”:{可编辑:true,键入:“string”},
“directorsequence:{可编辑:true,键入:“number”,验证:{min:1},
“isonballot”:{可编辑:true,键入:“boolean”},
“连接”:{可编辑:true,键入:“string”},
“MoreNames”:{可编辑:true,键入:“number”,验证:{min:0},
},
},
}
},
栏目:[
{字段:“namefirstlast”,标题:“Name”,编辑器:namesAutoComplete},
{字段:“directorsequence”,标题:“Director Sequence”,格式:“{0:n0}”},
{字段:“Isonbalot”,标题:“投票?”},
{字段:“连接”,标题:“连接”},
{字段:“更多名称”,标题:“更多名称?”,格式:“{0:n0}”},
{命令:[“编辑”],标题:“”,宽度:100}],
可排序:是的,
排序:{field:“namefirstlast”,dir:“desc”},
可编辑:“内联”,
工具栏:[{name:“create”,文本:“addnewdirector/Recipient”}]
});
找到了答案:
detailRow.find(".directorsOrRecipients").data("kendoGrid").dataSource.read();
detailRow.find(".directorsOrRecipients").data("kendoGrid").refresh();