Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:25:54+00:00 2026-06-18T05:25:54+00:00

I’m using the jQuery isotope plugin to filter a set of results based on

  • 0

I’m using the jQuery isotope plugin to filter a set of results based on their category. I’m trying to take it one step further and re-sort the filtered results simultaneously (for each category, the items will have a different sort order).

When a category is clicked, the items will be filtered to those with the matching category as a class. In my example below, there are two items: both are categorized as “category-speakers” and “category-supporters” so when I click on either of those categories in the filter navigation, both items appear. What I’d like to do now is have those items sort differently based on which category is in view.

When “Speakers” is selected, “post-1” would show first. When “Supporters” is selected, “post-2” would show first. The sort would be based on an additional class in the item (sort-speakers-1, sort-speakers-2, sort-supporters-1, sort-supporters-2, etc.).

I hope that makes sense! I tried using the getSortData option, but I”m doing something wrong. The isotope docs make sense and I’m able to filter and sort separately.. No luck simultaneously, though.

Simplified filter code below

HTML:

<!-- Grid of filterable/sortable items -->
<div id="Grid">

    <div id="post-1" class="category-supporters category-speakers item sort-speakers-1 sort-supporters-2" data-slug="lorem-ipsum-dolor">
        <div class="itemButton format-standard"></div>
        <div class="small-info" data-permalink="http://external-link.com" data-title="Lorem Ipsum">
            <div class="entry-image clearfix">
                <div class="hover-content zoom">
                    <a title="Lorem Ipsum" href="http://external-link.com" class="preload imgSmall item-preview iconPost" rel="">
                        <img src="logo.jpg" alt="" />
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div id="post-2" class="category-speakers category-supporters item sort-speakers-2 sort-supporters-1" data-slug="lorem-ipsum-dolor">
        <div class="itemButton format-standard"></div>
        <div class="small-info" data-permalink="http://external-link.com" data-title="Lorem Ipsum">
            <div class="entry-image clearfix">
                <div class="hover-content zoom">
                    <a title="Lorem Ipsum" href="http://external-link.com" class="preload imgSmall item-preview iconPost" rel="">
                        <img src="logo2.jpg" alt="" />
                    </a>
                </div>
            </div>
        </div>
    </div>        

</div>

JavaScript:

jQuery(document).ready(function(){

    $container = jQuery('#Grid');

    $container.isotope({
        itemSelector : '.item',
        transformsEnabled: false,
        masonry: {
            columnWidth: 160
        }
    });

   $optionLinks.click(function(){
        var $this = jQuery(this);

        var $optionSet = $this.parents('.option-set');
        $optionSet.find('.selected').removeClass('selected');
        $this.addClass('selected');        
        $this.parent().parent().prev('a').addClass('selected');

        // make option object dynamically, i.e. { filter: '.my-filter-class' }
        var options = {},
        key = $optionSet.attr('data-option-key'),
        value = $this.attr('data-option-value');

        // parse 'false' as false boolean
        value = value === 'false' ? false : value;
        options[ key ] = value;
        if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
            // changes in layout modes need extra logic
            changeLayoutMode( $this, options )
        } else {
            // otherwise, apply new options
            $container.isotope( options );
        }
        return false;
    });    

});

Any suggestions on how to modify the JavaScript to resort each time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:25:56+00:00Added an answer on June 18, 2026 at 5:25 am

    The isotope docs make sense and I’m able to filter and sort separately.. no luck simultaneously, though.

    I’m currently working on a project with isotope too. I have found no problems sorting and filtering at once.

    I recommend putting your sorting values in a data attribute:

    <div data-sort-speaker="1"> 
    

    This makes it easier to retrieve the values (but that’s just me). Then:

    $.container.isotope({ 
        // all your other initialization options here.
        getSortData: { 
            speakers: function ($elem) {
                return $elem.data('sort-speaker'); // will return 1 in this example.
            } 
        } 
    });
    
    // On button click:
    $.container.isotope({filter: '.category-speakers', sortBy: 'speakers'});
    

    Any suggestions on how to modify the JS to resort each time?

    You can try calling

     $.container.isotope('reLayout');
    

    each time. But this shouldn’t be needed if you modify the filter or sort options each time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm making a simple page using Google Maps API 3. My first. One marker
I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.