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

Multiple filters, same target #9

Open
lroggen opened this issue Apr 1, 2015 · 5 comments
Open

Multiple filters, same target #9

lroggen opened this issue Apr 1, 2015 · 5 comments

Comments

@lroggen
Copy link

lroggen commented Apr 1, 2015

Great jQuery plugin! I'm having a slight issue though. I'm trying to target target the same table rows with two different InstaFilters, one a checkbox and the other a text input field. It works well if I use one or the other but if I try to check a box and enter text, all of the td's in my table row disappear.

Have you seen anything like this before? Can I even use two filters on the same targets?

    $('#task-search').instaFilta({
        scope: '.wrapper',
        targets: 'tr.task',
        markMatches: true
    });

    var instaFilta = $('#user-search').instaFilta({
        scope: '.wrapper',
        targets: 'tr.task'
    });


    var $userCheckboxes = $('.user-checkbox');
    $userCheckboxes.on('change', function() {
        var checkedCategories = [];
        $userCheckboxes.each(function() {
            if ($(this).prop('checked')) {
                checkedCategories.push($(this).val());
            }
        });
        instaFilta.filterCategory(checkedCategories);
    });

Check Box:
three
Text Input and initial view:
one
Result of using both at once:
two

@chromawoods
Copy link
Owner

Just to be clear of the expected result: So if you first check a checkbox, then start typing in the search field, the expected behavior is that the filtering process should only be applied to the remaining visible hits, right? So it should be like a filter-on-filter kind of thing? So any filtering process should ever only apply to whatever result is currently remaining.

I have thought about this feature before and I would like to implement it. I don't think you can do it currently. I'm going to have to look into it and get back.

@lroggen
Copy link
Author

lroggen commented Apr 1, 2015

You are correct, the filter would limit everything to the checked item(s) and the search string. If it is not too complex, it would be a great feature!

@deutschehandarbeit
Copy link

I am really looking forward to this.

@brt-tito
Copy link

Yes, me too. That's a thing I really can use.

@chromawoods
Copy link
Owner

Right, beginning to feel the heat surrounding this issue. 🔥

I assure you all that I am considering this feature. Just not sure about the flow of things. I don't want to break any current functionality either. At the moment, the plugin kinda requires a text field as its main element, but it would be nice if this could be made more flexible.

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

3 participants