CodeIgniter Forums
How to make Isotope work with multi-filters and sort ascending / descending? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forum-1.html)
+--- Forum: Lounge (https://forum.codeigniter.com/forum-3.html)
+--- Thread: How to make Isotope work with multi-filters and sort ascending / descending? (/thread-68990.html)



How to make Isotope work with multi-filters and sort ascending / descending? - thomas9059 - 09-25-2017

I’m trying to create a multi-filter menu of which one drop-down is to sort by most popular to the least popular.


When I select “most” and “least” from the drop-down for the FIRST TIME, it works as expected. However, when I go to select “most” for a second time, the sort doesn’t work.

Any ideas what might be causing this?

Here’s my code snippet:

// On popular selection
     $( '#popular' ).on('change', 'select', function () {
     var $this = $(this);

     // Get the data-category attribute from the selection made
     var $rank = $this.children('Confusedelected').val();

     // Here's where the code breaks when a user selects a drop-down selection after the first time
     if ($rank === 'most') {
     $cards.isotope({sortBy: 'rank'});
     } else {
       $cards.isotope({sortBy: 'rank', sortAscending: false});
     }
   });



Any ideas what might be causing the issue?


RE: How to make Isotope work with multi-filters and sort ascending / descending? - InsiteFX - 09-26-2017

Maybe this will help not sure.

Confusedelected Selector