Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Count number of items after filtering #140

Open
stankobrin opened this issue Jun 3, 2020 · 1 comment
Open

[HELP] Count number of items after filtering #140

stankobrin opened this issue Jun 3, 2020 · 1 comment

Comments

@stankobrin
Copy link

Filterizr version
2.2.4

Describe the issue in details
How would I get a count of items after the filter. If I try and count the number of .filtr-item's it always returns to total number, not the filtered number. I have this count running in the onFilteringEnd callback.

@fdavidsen
Copy link

After a number of trials, I found this piece of code solves your issue.

const filterizr = new Filterizr('.filter-container', {
  callbacks: {
    onFilteringEnd: () => {
      console.log($('.filtr-item').length - $('.filteredOut').length);
    }
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants