gpt4 book ai didi

jquery - 同位素多排序,混合有上升和下降

转载 作者:行者123 更新时间:2023-12-01 03:11:29 25 4
gpt4 key购买 nike

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

问题在于某些列需要升序排序,而其他列则需要降序排序。根据文档,同位素的工作原理是设置一组值和这些值的方向,而不是两者的混合。见下文:

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' ],
}
});

最佳答案

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

EG:

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

关于jquery - 同位素多排序,混合有上升和下降,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28166950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com