I have a button in the body that when clicked, should sort descending. When I do, nothing happens. I believe my code is correct, but perhaps I'm missing something?
Here's the js:
Tasks = new Mongo.Collection("tasks");
Template.body.events({
"click .sort_title": function () {
return Tasks.find({}, {sort: {movie_title: -1}});
console.log('Sorting has been clicked');
}
});
And here's the HTML:
<table class="item_db">
<tr>
<th>Title <i class="fa fa-sort sort_title"></i></th>
</tr>
</table>
clicking the button doesn't even pass to the console log command, so it breaks at the task.
console.log()above the return statement to confirm that the event is really not firing. if it does fire the log, then maybe the problem is in yourTasks.find()code.returnstatement is before it. Are you sure you have the field namemovie_titleright? The code looks right to me as well.