【发布时间】:2021-10-14 06:14:39
【问题描述】:
我有以下剑道网格:
$("#grid").kendoGrid({
dataSource: {
transport: {
url: "customers",
type: "GET",
dataType: "json"
}
},
height: 550,
columns: [{
field: "contactName",
title: "Contact Name",
width: 240
}, {
field: "contactTitle",
title: "Contact Title"
}, {
field: "companyName",
title: "Company Name"
}, {
field: "country",
width: 150
}]
});
来自服务器的 JSON 响应如下所示:
{
"date": "2020-02-02",
"responseType": "customer contact",
"customerContact": [{
"contactName": "Bob Smith",
"contactTitle": "Manager",
"companyName": "Acme",
"country": "Canada"
},{
//more customerContact data
}]
}
网格正在尝试使用这个完整的 JSON 对象进行填充。如何告诉它只使用对象中的 customerContact 属性?
我还需要从响应中获取 date 和 responseType 以使用以下方法填充网格外的 HTML 元素:
$("#title").append('<h3>' + response.reponseType + ' at ' + date + '</h3>');
如何取出responseType 和date 来填充标题?
【问题讨论】:
标签: jquery json kendo-ui kendo-grid