我正在使用剑道角度图和多选。现在我两次调用相同的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"
}
]
}
我想添加" List"在网格和" NameList"在一次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;
}
答案 0 :(得分:1)
如果您自己手动发出请求,并且在图表的DataSources中使用local (custom) transport或静态dataSource.data
赋值,则可以在场景中实现两个小部件与一个请求的数据绑定。多选