samedi 30 avril 2016

MixItUp: Clear filters per group

In my project I'm using MixItUp and found this particular code example:

http://ift.tt/1N9JWYr

self.$reset.on('click', function(e){
  e.preventDefault();
  self.$filterUi[0].reset();
  self.$filterUi.find('input[type="text"]').val('');
  self.parseFilters();
});

I assume the above snippet is what you need to look at.

I'd really like to know how I can add an extra checkbox per filter group (in each column) that will act as a 'filter none'/'show all' filter for that particular group.

This checkbox should be checked by default (the others unchecked) and be unchecked when one or more checkboxes from that group are checked instead. Unchecking all checked non-'show-all' checkboxes should then again check the 'show-all' checkbox of that group.

In the code example above, you may ignore the search field and clear button. In fact, the 'show all' checkbox that I'd like each group to have should function the same as the clear filters button from the example but on a per-group basis.

Another example I found has similar functionality but uses dropdowns for each group, which is not an option for my project:

http://ift.tt/1QGEWVY

If someone can somehow combine these two to have checkboxes and clear buttons per group, that'd would be highly appreciated.




Aucun commentaire:

Enregistrer un commentaire