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

Question about filtering #159

Open
delco821 opened this issue Oct 19, 2017 · 0 comments
Open

Question about filtering #159

delco821 opened this issue Oct 19, 2017 · 0 comments

Comments

@delco821
Copy link

First of all thank you for this great example of client side filtering. There are so many useful ways to use this concept. In one of the examples (bytepartners), i saw a different use of adding filters.
Instead of .Addcriteria, i see .addFilter, and it seems to be behaving different. Within the same filtering group, the filter elements are considered as they have AND between them, instead of OR. In other words, the checkboxes are behaving like radio buttons.
I am wondering if it's this section where I need to make modifications to correct the issue:
var include = true;
while (f-- && include) {
var filter = filters[f];
if (typeof urlFilters[filter.key] == 'undefined') {
urlFilters[filter.key] = filter.value;
} else if (urlFilters[filter.key].indexOf(filter.value) === -1) {
urlFilters[filter.key] += ',' + filter.value;
}

            if(item[filter.key].constructor === Array) {
                if (item[filter.key].includes(filter.value)) {
                    continue; 
                } else {
                    include = false; 
                }
            }

Any assistance is much appreciated.

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

No branches or pull requests

1 participant