https://jsfiddle.net/964mffes/9/
====================================================================
Create a slick that displays its items on multiple rows then try to filters the items independently not by column.
====================================================================
I was expecting the slider to recreate its rows and columns completely after filtering out each item but instead of this the filter is applied at column level which is unexpected for me.
====================================================================
Using the hide() method may work. I used and worked.
odd.click(function() {
oddEvenSlider.slick( 'slickFilter', function( index ) {
var $currentSlide = $( this );
var $slideItem = $currentSlide.find( '.slide-item' );
$slideItem.each(function(){
if($(this).hasClass('odd'))
{$(this).hide();}
});
return true;
});
});
Thank you for your time.
Well this code hides the undesired items but doing this breaks the items order, if you check the elements you'll see that the slider adds the items first untill it completes the column required number then goes to next lane so when you filter the items they should all expect maybe the last one have 2 rows per column and decrease the columns number. Hope I make sens.
Thank you and have a nice one
+1 Having the same issue.
What I ended up doing:
.html(), then initialize slick.replaceWith().filter() as you normally would, removing the elements you don't want to keep with .remove()I'm effectively recreating the entire slider with filtered out items. It's ugly, but it works.
(My previous attempt was to simply deinit slick, hide the items I want to filter out, and reinit slick again. This didn't work, because slick will reset row items to display: inline-block.)
Most helpful comment
Thank you for your time.
Well this code hides the undesired items but doing this breaks the items order, if you check the elements you'll see that the slider adds the items first untill it completes the column required number then goes to next lane so when you filter the items they should all expect maybe the last one have 2 rows per column and decrease the columns number. Hope I make sens.
Thank you and have a nice one