我正在尝试使用微风和淘汰赛的样本
manager.executeQuery(query).then(function(result){
console.log(result);
ko.applyBindings(result);
}).fail(function(e) {
console.log(e);
alert(e);
});
在控制台中打印时。我在路径中有两个对象,在路径中data.XHR.result.responseJSON
有两个对象data.results
但是在由于淘汰绑定而创建的视图中,我将第二组值填充了两次。(我在数据库中有两组值)
注意:如果我没有定义任何元数据,则此代码有效。问题出在我使用元数据的场景中
元数据
var sample=sample||{};sample.metadata=
{
"dataServices":[
{
"serviceName":"/sample",
"hasServerMetadata":true,
"jsonResultsAdapter":"webApi_default",
"useJsonp":false
}
],
"structuralTypes":[
{
"shortName":"Employee",
"autoGeneratedKeyType":"None",
"defaultResourceName":"Employee",
"dataProperties":[
{
"name":"id",
"dataType":"MongoObjectId",
"isNullable":false,
"defaultValue":"",
"isPartOfKey":true,
"validators":[
{
"name":"required"
}
]
},
{
"name":"name",
"dataType":"String",
"maxLength":100,
"validators":[
{
"maxLength":100,
"name":"maxLength"
}
]
},
{
"name":"age",
"dataType":"String",
"maxLength":100,
"validators":[
{
"maxLength":100,
"name":"maxLength"
}
]
}
]
}
],
"resourceEntityTypeMap":{
"Employee":"Employee"
}
};