简体   繁体   中英

Jquery DataTable Group Sort order

I am using Jquery DataTable ( https://datatables.net/ ) plugin and have grouped the rows based on 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. 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 .

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
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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