简体   繁体   English

jQuery DataTable组排序顺序

[英]Jquery DataTable Group Sort order

I am using Jquery DataTable ( https://datatables.net/ ) plugin and have grouped the rows based on column0. 我正在使用Jquery DataTable( https://datatables.net/ )插件并根据column0对行进行分组。 The groups that are generated are in Alphabetical order by default, but I would like to make these groups order according to my need. 默认情况下,生成的组按字母顺序排列,但是我想根据需要使这些组排列。 Is there a way to do this? 有没有办法做到这一点? I saw this documentation ( https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customGroupOrdering.html ) but it is asking to write HTML for each row. 我看到了这个文档( https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customGroupOrdering.html ),但它要求为每一行编写HTML。 Not sure if thats the right way. 不知道那是正确的方法。 Can someone know how to go about this? 有人知道如何去做吗?

Thanks Anmol 谢谢安莫尔

The grouping functionality provides sorting based on the jquery code suggested in https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customGroupOrdering.html . 分组功能基于https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customGroupOrdering.html中建议的jquery代码提供排序。

You can modify the sorting method as per your need and use it: 您可以根据需要修改排序方法并使用它:

$(document).ready( function () {
    $('#example').dataTable().rowGrouping({
        iGroupingColumnIndex: 1,
        sGroupingColumnSortDirection: "asc",
        iGroupingOrderByColumnIndex: 0
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM