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

manual search with manual content handling #29

Open
taivu opened this issue Nov 30, 2016 · 3 comments
Open

manual search with manual content handling #29

taivu opened this issue Nov 30, 2016 · 3 comments

Comments

@taivu
Copy link

taivu commented Nov 30, 2016

var plateFilter = new Jets({
            callSearchManually: true,
            contentTag: '.plates',
            hideBy: 'opacity: 0; height: 0; width: 0; padding: 0; margin: 0; display: none;',
            manualContentHandling: function(filterTag) {
                // console.log(tag.querySelector('.plate-title').textContent);
                
                console.log('filtering by attribute...');
                console.log(filterTag.getAttribute('data-categories'));
                return filterTag.getAttribute('data-categories');
            }
        });
        $('.plateGallery-filter label').on('click', function() {
            console.log('filtering...');
            var FILTER_INPUT = $(this).find('input');

            if ( FILTER_INPUT.prop('checked') ) {
                var FILTER_CATEGORY = FILTER_INPUT.attr('data-category');

                console.log('filtering for: ' + FILTER_CATEGORY);
                plateFilter.search(FILTER_CATEGORY);
            } else {
                plateFilter.search('');
            }
        });

the "console.log('filtering by attribute...');" doesnt run in the manualContentHandling method.

I couldnt find any documentation on using both, only separately.

@taivu
Copy link
Author

taivu commented Dec 2, 2016

nevermind. I had 2 instances of Jets, and the first instance manualContentHandling was okay. The 2nd one never ran, but i moved everything to the first instance. Not sure if this is by design or if its a bug, but figured its worth mentioning.

@NeXTs
Copy link
Owner

NeXTs commented Dec 2, 2016

Hey
it should not work the way you described, each instance should has own manualContentHandling..
could you please provide example (at least simplified) at codepen?

@taivu
Copy link
Author

taivu commented Dec 7, 2016

heres a simplified codepen example. I have 2 instances of Jets, targeting the same class, ".plate". Check the console, i put console.logs in them, and only the 1st one runs.

http://codepen.io/anon/pen/ZBombX

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

2 participants