Isotope filter by price not working when into the hundred thousands

I have an isotope filter for properties. When sorting by price anything that has 6 digits moves out of price order and to the beginning. For example the order shoulde be 46,000 52,000 98,000 112,000. Instead the 112,000 comes first.

I’m assuming its only reading the first couple or few digits so is seeing that the 1 should come first.

Read More

How can I tell it to sort in a monetary value?

Here is the code I’m using –

$( function() {
  var $container = $('.full-wrapper');
    $container.isotope({
        filter: '*',
        itemSelector: '.development-tile',
        masonry: {
        isFitWidth: true

    },

  getSortData: {
    name: '.tile-title',
    price: '.tile-price'
  }
});

Related posts

Leave a Reply

1 comment

  1. This may work for your numbers:

    $( function() {
    var $container = $('.full-wrapper');
    $container.isotope({
        filter: '*',
        itemSelector: '.development-tile',
        masonry: {
        isFitWidth: true
    
    },
    getSortData: {
    name: '.tile-title',
     price: function( itemElem ) {
        var price= $( itemElem ).find('.tile-price').text();
        return parseFloat( price.replace( /[()]/g, '') );
      }
    }
    });