我正在使用剑道角图和多选。现在我两次调用相同的 api 来加载两者中的数据。有没有办法在同一个 api 调用中定义多个模式?我的数据如下
{
"List": [
{
"Name": "xyz",
"Activation": "2016-12-08",
"End": "2016-12-09",
"Run": "45",
"Status": "FAILURE",
"color": "red"
},
{
"Name": "wqe",
"Activation": "2016-12-07",
"End": "2016-12-08",
"Run": "46",
"Status": "FAILURE",
"color": "red"
}
],
"NameList": [
{
"Name": "joo"
},
{
"Name": "foo"
},
{
"Name": "too"
}
]
}
我想在一个 api 调用中在网格中添加“列表”,并在多选中添加“名称列表”。
目前我正在使用以下代码调用 api
function getDataSource(requestUrl) {
var dataSource = {
transport: {
read: requestUrl,
dataType: "json"
},
schema: {
data: "List",
total: function (response) {
return response.StatisticList.length;
},
model: {
fields: {
Name: { type: "string" },
Activation: { type: "date" },
End: { type: "date" },
Run: { type: "number" },
Status: { type: "string" },
color: { type: "string" }
}
}
},
sort: { field: "ActivationTime", dir: "desc" },
pageSize: common.Grid.pageSize
};
return dataSource;
}
function getMultiSelectDataSource(requestUrl) {
var dataSource = {
transport: {
read: requestUrl,
dataType: "json"
},
schema: {
data: "NameList",
model: {
fields: {
Name1: { type: "string" }
}
}
}
};
return dataSource;
}