0
我正在使用Meteor處理我的第一個項目,並且在排序時遇到了一些困難。從mongo中刪除流星項目中的排序
我有一個選擇元素,其中用戶選擇選項,然後顯示在列表中。但我不知道如何刪除排序並顯示所有值。
我想:
admin.html
<select name="select">
<option value="all">All</option>
<option value="bad">Bad</option>
<option value="sad">Sad</option>
<option value="good">Good</option>
<option value="best">Best</option>
</select>
admin.js
Template.adminLayout.events({
"change select": function (event) {
// Prevent default browser form submit
event.preventDefault();
// Get value from select element
const listEmo = $(event.target).val();
console.log(listEmo);
if(listEmo == "all") {
Session.set("HeardFrom", null);
} else {
Session.set("HeardFrom", listEmo);
}
}
});
feed.js
Template.feed.helpers({
feedbacks() {
return FeedbacksList.find({ feedback: Session.get("HeardFrom") });
},
});