0
유성과 함께 블로그 작업을하고 있는데 검색 부분에 도달했습니다. 이제 검색 조건에 따라 템플릿 변수로 이동하는 데이터를 변경하고 싶습니다. 현재로서는 템플릿에서 렌더링 할 데이터를 다시 정렬하는 방법을 이해하지 못합니다. HTMLMeteor 템플릿 쿼리 변경, 데이터베이스에서 콘텐츠를 변경하는 방법?
<template name="posts">
{{#each post}}
<div class = "postWrapper">
<p>{{postTitle}} - <small><em>{{userName}}<em></small></p>
<p><small>{{postDate}}</small><p>
<div class="postText">{{safe 'postText'}}</div>
<br/>
</div>
{{/each}}
</template>
자바 스크립트
Template.posts.post = function(){
return TestPosts.find({}, {sort: {timeStamp: -1}, limit: 100});
}
그것을 다른 뭔가를해야만으로 정렬되도록 나는 Template.posts.post 쿼리를 어떻게 변경합니까 : 여기
내가 지금 가지고있는 것입니다 타임 스탬프보다. Template.posts.post 쿼리를 변경하면 이벤트가 시작될 때 아무 것도 나타나지 않습니다.Template.searchForm.events = {
"click .cancelBtn": function(){
$("#lightbox-container, #searchForm, #postForm").hide();
},
"click #searchBtn": function(){
var reply = TestPosts.find({}, {sort: {timeStamp: 1}});
//what do I need here to be able to change the posts returned
//to the template?
}
}
meteor.render를 사용하려고했지만 아무 것도하지 않았습니다. 어떤 지침이 좋을 것입니다.
는,이 많이 변경합니다. 시간 내 주셔서 감사합니다. –