Vue-tables-2: How to remove a filter?

Created on 13 Mar 2017  路  4Comments  路  Source: matfish2/vue-tables-2

I have a custom filter, let's call it private. So, whenever it's present, I only want to show the private topics. If it's not present, I show all the topics.

So in order to apply it, I'm using:

bus.$emit('vue-tables.filter::private', true);

However, I can't find an event to remove that filter from the table filters. Is it possible just now? Or does it need to be implemented?

Most helpful comment

+1 for this feature.

At the moment I am using custom filters and I am not sure how I can reset the filters, so I can see all the items in the table again.

Thank you

All 4 comments

@matfish2 it's working for me doing something like this on register-server-filters.js

var bus = require('../bus');

module.exports = function() {

  this.opts.customFilters.forEach(function(filter) {
        bus.$on('vue-tables.filter::' + filter, function(value) {
          this.customQueries[filter] = value;
          this.refresh();
        }.bind(this));
        bus.$on('vue-tables.remove-filter::' + filter, function() {
          delete this.customQueries[filter];
          this.refresh();
        }.bind(this));
  }.bind(this));
}

Do you think it's possible to add it to the the official repository? Thanks.

Seems a bit like an edge case. Maybe if others will ask for this functionality.

@matfish2 great - I'll keep it in my fork then. If you ever add this functionality, just let me know and I'll go back to use your version. 馃槃

+1 for this feature.

At the moment I am using custom filters and I am not sure how I can reset the filters, so I can see all the items in the table again.

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seivad picture seivad  路  3Comments

bb78657 picture bb78657  路  6Comments

JKHeadley picture JKHeadley  路  4Comments

ydogus picture ydogus  路  3Comments

manrix picture manrix  路  3Comments