NewToJS
NewToJS

Reputation: 2101

Isotope won't sort alphabetically

I'm trying to extract text and sort that text alphabetically with the isotope library..the text is in each p tag with the class of .box-title. I'm passing a function to get that text via the getSortData option..... but this is not working. Any ideas why? I've inspected $container, $elem and $('.box-title') and they both return arrays of data

$container.isotope({
    getSortData: {
        name: function ($elem) {
            return $elem.find('.box-title').text();
        }
    }
});
$container.isotope({
    sortBy: 'name'
});

Upvotes: 1

Views: 478

Answers (1)

Neash
Neash

Reputation: 55

You have an error in your code.

name: function (elem) {
            return $(elem).find('.box-title').text();
      }

Upvotes: 1

Related Questions