Jquery DataTables将排序顺序更改为desc [英] Jquery DataTables change order to desc when it sorts
问题描述
我正在使用DataTables来显示一些数据,它的工作原理很好,但是我想稍微自定义一下,不知道如何。
我想做的是当一个用户单击列标题以对该列进行排序,我希望它最初按顺序排序而不是递增。有没有办法这样做?
看看这个:数据表排序方向控件示例
您可以执行以下操作: ($ {
$ pre $ $(document).ready(function(){
$('#example')。dataTable $ baoColumns:[
{asSorting:[desc,asc]},// first sort desc,then asc
]
});
});
I am using DataTables to display some data and it works great but I want to customize it slightly and not sure how.
What I want to do is when a user clicks on a column heading to sort that column I want it to initially order descendingly rather than ascendingly. Is there any way to do this?
Have a look at this: DataTables sorting direction control example
You can do something like:
$(document).ready(function() {
$('#example').dataTable( {
"aoColumns": [
{ "asSorting": [ "desc", "asc" ] }, //first sort desc, then asc
]
} );
} );
这篇关于Jquery DataTables将排序顺序更改为desc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!