Best Practise for Custom Filter for aldeed:tabular?

Hi guys,

can you recon an elegant&stable solution for creating custom filters for aldeed:tabular created by the famous @aldeed :smiley:

I want to do about 4-6 custom filter-fields searching in different rows and basically generating a mongo-style selector which I then pass over to aldeed:tabular.

Right now I am doing it manual and feels like too much manual work:

This code sucks as it gets much more complex with more filters (right now I have 2 custom filters):

Template.exampleThirdPartiesTablesFilters.onCreated(function () {
  this.theFilter = new ReactiveVar();
  this.nameFilterValue = new ReactiveVar();
  this.scoopFilterValue = new ReactiveVar();

  this.autorun(function() {
    var theFilter = {};

    // build a Mongo-Style Selector
    // this SUCKS!!!!
    var nameFilterValue = Template.instance().nameFilterValue.get();
    var scoopFilterValue = Template.instance().scoopFilterValue.get();
    if (nameFilterValue && scoopFilterValue) {
      theFilter = {
        $and: [
          {customerName: {$regex: Template.instance().nameFilterValue.get(), $options: 'i'}},
          {'scoopItems.scoopId': Template.instance().scoopFilterValue.get()},
    } else if (nameFilterValue && !scoopFilterValue) {
      theFilter = {
        customerName: {$regex: Template.instance().nameFilterValue.get(), $options: 'i'},
    } else if (!nameFilterValue && scoopFilterValue) {
      theFilter = {
        'scoopItems.scoopId': Template.instance().scoopFilterValue.get()

   // ...

Can you guys recon a stable package to use?

1 Like

Can you guys recon a stable package to use?

Not that I know of but let me know if you find one! I wish the whole, search/pagination system was decoupled from the table so that you could use that functionality with blaze/react/angular tables/lists.

There are 2 apps out there that build upon aldeed:tabular and try to give us filtering.

BUT they are both really buggy:

  2. (based on collection2 and independent from tabular)

Did you guys get anywhere further?

I was able to just use the ‘selector’ property to save a query selector that updates the results. It doesn’t narrow to a specific column specifically but works well enough for my use case. Building up the query object can be tricky with multiple $and & $or selectors.