我第一次单击按钮时,一切都绑定正确。但是当我第二次单击按钮时,所有旧值仍然绑定到我的视图?如何将新绑定重新应用到我的微风.js 视图模型?
JS
var manager = new breeze.EntityManager('/breeze/corporations');
$("#myButton").click(function () {
var query = breeze.EntityQuery.from("Corporations").where("Name", "startsWith", "Zen");
manager.executeQuery(query)
.then(querySucceeded)
.fail(queryFailed);
function querySucceeded(data) {
var ib = $("#infoBox")[0];
ko.applyBindings(data, ib);
}
});
html
<div id="infoBox"">
<ul data-bind="foreach: results">
<li>
<strong><span data-bind="text:City"></span></strong>
<span data-bind="text:Name"></span>
</li>
</ul>
</div>