O
O
OrionShah2015-11-14 14:28:01
meteor
OrionShah, 2015-11-14 14:28:01

How to make a filter in a directory in MeteorJS?

Good day. There was such a question - how to make a filter for the catalog on MeteorJS?
What is available: a directory with certain objects that have a pack (9 pcs.) of bool-type properties, the site has a list with checkboxes that should control the displayed objects. For the second day I can not find a solution, I ask for help here - how can this be implemented? The main thing is that it works, so to speak :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
E, 2015-11-14
@aylo

If on a standard delivery of a meteor (without react or angular), then as an option to do it through sessions.
When publishing data from the server, on the client in any case you have a similar line

Template.productList.helpers({
  products: function() {
    return Product.find();
})

Let's make it like this:
Template.productList.helpers({
  products: function() {
    return Product.find(Session.get('filterStatus'));
})

And already for the events in the filter we do this:
Template.productList.events({
  'click #allProducts': function() {
    Session.set('filterStatus', {});
  },
  'click #filterStatus1': function() {
    Session.set('filterStatus', {
      status: 1
    });
  }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question