0
以下TaffyDB腳本成功輸出整個數據庫:如何在Taffydb中集成.filter()?
db().each(function (name){
var bodyType=(name["bodyType"]);
var category=(name["category"]);
var name2=(name["name2"]);
var photo=(name["photo"]);
var resource=(name["resource"]);
var caption=(name["caption"]);
output = document.getElementById("display");
output.innerHTML+="<div class='segment'><p class='title'>" + bodyType + ": " + name2 + "</p>" +
"<img class='pic' src='" + photo + "' width='150px'>" +
"<p class='caption'>" + caption + "</p>" +
"<p class='more'><a href='" + resource + "'>More</a></p></div>";
});
我的問題是關於如何過濾內容。該網站有這樣的代碼:
db().filter({column:value});
如何更改上面的代碼進行整合呢?
db().filter({bodyType:buggy});
這不起作用:
db().each(function (name){
var bodyType=(name["bodyType"]);
var category=(name["category"]);
var name2=(name["name2"]);
var photo=(name["photo"]);
var resource=(name["resource"]);
var caption=(name["caption"]);
db().filter({bodyType:buggy});
output = document.getElementById("display");
output.innerHTML+="<div class='segment'><p class='title'>" + bodyType + ": " + name2 + "</p>" +
"<img class='pic' src='" + photo + "' width='150px'>" +
"<p class='caption'>" + caption + "</p>" +
"<p class='more'><a href='" + resource + "'>More</a></p></div>";
});