【发布时间】:2014-12-29 01:58:49
【问题描述】:
我正在尝试在下拉列表更改时过滤我的收藏,这是我在模板管理器中的代码
Template.postsList.events({
"change .typeselection": function(e, t){
console.log("drop changed");
return Session.set("type", $("[name=type]").val());
}
});
这是我的模板代码:
<template name="postsList">
<select name="type" id="type" value="" placeholder="type the adress" class="form-control typeselection">
<option value="Restaurant">Restaurant</option>
<option value="Hotel">Hotel</option>
<option value="Shop">Shop</option>
</select>
<div class="posts">
{{#each postsWithRank}}
{{> postItem}}
{{/each}}
{{#if nextPath}}
<a class="load-more" href="{{nextPath}}">Load more</a>
{{else}}
{{#unless ready}}
{{> spinner}}
{{/unless}}
{{/if}}
</div>
</template>
【问题讨论】:
-
我不知道如何过滤下拉列表更改的帖子。
-
您能否将您的
postsList集合结构和postItem模板代码添加到问题中,以便我们以更好的方式回答 -
你能告诉我你通常如何过滤 dropdowlist 变化,而不关心我的文档结构吗?
-
你确定它不应该是 Session.set('type',$(e.target).find('[name=type]').val() ?
标签: meteor