Jets.js icon indicating copy to clipboard operation
Jets.js copied to clipboard

manual search with manual content handling

Open taivu opened this issue 8 years ago • 3 comments

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 avatar Nov 30 '16 22:11 taivu

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.

taivu avatar Dec 02 '16 16:12 taivu

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?

NeXTs avatar Dec 02 '16 18:12 NeXTs

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

taivu avatar Dec 07 '16 14:12 taivu