luis-almeida / filtrify

Beautiful advanced tag filtering with HTML5 and jQuery
Other
644 stars 112 forks source link

Question about checkbox #59

Closed EdnilsonRobert closed 4 years ago

EdnilsonRobert commented 10 years ago

Hi, Luis.

I'm using Filtrify with multiple categories to filter some projects by state and city. Currently I need a new filter boolean (checkbox) to filter ready projects and projects under construction.

Is there any way to implement a checkbox field in the filter?

Great plugin. Congrats.

EdnilsonRobert commented 10 years ago
$(function() {
    var ft = $.filtrify("container", "placeholder", { close : true });
    $("#my-checkbox").change(function() {
        ( $(this).is(":checked") ) ? ft.trigger({ ready : ["ready"] }) : ft.reset();
    }
});

I'm using this code to filter ready projects and it's working fine. There is just one problem: if any filter already selectd (e.g select by state or by city), the method reset(); return all elements again. My javascript skill is very limited and I really don't know how to persists the filters selected before the checkbox. Any idea?