我遇到了有线问题,在应用自定义绑定之前和之后,Array 的记录数为 8,但是在调试绑定时,它们的 Array 为空。由于数组为空,因此 Grid 不显示任何内容。我究竟做错了什么?
var vM = {
recordsCount: ko.observable(),
countries: ko.observableArray()
};
$(function () {
getAllCountries();
// Handler for .ready() called.
//alert(myns.JavaScript1);
//alert(myns.JavaScript1);
//alert(myns.JavaScript2);
});
var serviceName = "/breeze/CountriesBreeze/";
var manager = new breeze.EntityManager(serviceName);
/*** supporting functions ***/
function getAllCountries() {
var query = breeze.EntityQuery.from("GetCountries");
console.log("Getting Countries");
return manager.executeQuery(query)
.then(function(data) {
vM.countries(data.results);
alert(vM.countries().length);
ko.applyBindings(vM);
alert(vM.countries().length);
}).fail(
alert( "Error getting Data")
)
}
</script>
<div id="log"></div>
]
}">
</table>