同位素多重排序,具有上升和下降的混合

时间:2015-01-27 09:23:26

标签: jquery sorting jquery-isotope

我正在使用Isotope jQuery plugin对某些表格数据进行排序。这一切都运行正常,但现在我需要对多个列进行排序,即documented

问题是某些列需要按升序排序,而其他列则需要降序排列。根据文档,Isotope通过为这些值设置一组值和方向来工作,而不是两者的混合。见下文:

var $container = $('#multiple-sort-by .isotope').isotope({
  // sort by color then number
  sortBy: [ 'color', 'number' ],
  sortAscending: true
});

有可能吗?

我期望的语法可能是:

var $container = $('#multiple-sort-by .isotope').isotope({
  // sort by color then number
  sortBy: {
      [ 'color', 'asc' ],
      [ 'number', 'desc' ],
  }
});

1 个答案:

答案 0 :(得分:4)

我发现文档的不同区域概述了如何执行此操作。您可以改为向sortAscending提供对象,而不是我建议的语法。

EG:

$container.isotope({ 
    sortBy: sortValue,
    sortAscending: {
        color: true,
        number: false,
    }
});