1
我辦一件輕而易舉的投影查詢:微風項目 - 空字段刪除
var item;
breeze.EntityQuery
.from("SomeTable")
.where("Id", "==", id)
.select("A, B, C, D")
.using(myEntityManager).execute()
.then(function(data) { item = ko.observable(data.results[0]); });
並說在表中的行,B和C是空的,我會回來的對象,而B和C.
{
A: "somevalue",
B: "someothervalue"
}
在UI我:
<div data-bind="with: item">
<span data-bind="text: A" />
<span data-bind="text: B" />
<span data-bind="text: C" />
<span data-bind="text: D" />
</div>
然後我得到的錯誤 -
ReferenceError: Unable to process binding "with: function(){return item}" Message: Unable to process binding "text: function(){return B}" Message: 'B' is undefined
我錯過了什麼嗎?如何在結果中得到B和C,其值爲null?
好吧,但我會期待微風返回字段,值爲null。如果知道value = null是多麼重要?它是否對0或空字符串進行相同操作? – user210757 2015-04-01 16:53:04
而且,查詢一個實體不會以這種方式工作。如果你查詢一個實體,沒有投影,沒有客戶端模型類,你仍然得到一個微風。存在空字段。 – user210757 2015-04-01 17:08:54
我只能說這個代碼的工作原理與http://learn.breezejs.com/網站上的一樣。 – Tomalak 2015-04-01 17:26:07