Grouping: Sorting rows within groups

Grouping: Sorting rows within groups

dylanmacdylanmac Posts: 49Questions: 7Answers: 1

Hi Allen or whoever answers this question,

I have a table that I am grouping according to this example:
https://datatables.net/examples/advanced_init/row_grouping.html

My implementation is slightly different than the above in that I am grouping according to the values in one hidden column, and then (hopefully) sorting within that group according to the values in another. In any given group there is one "parent" value and multiple "child" values. The "parent" is the top-most result and the only one visible. The child rows are hidden below the parent until the user clicks on an accordion icon in the parent row and reveals the children.

I assume that the sorting I want to do should happen somewhere inside of this function:

api.column(2, {page:'current'} ).data().each( function ( group, i ) {
           if ( last !== group ) {
                $(rows).eq( i ).addClass('accordion-header');
                    last = group;
                }
} );

But I'm not sure how.

I also have a another question about adjusting pagination so that it only counts "parents" per page as opposed to total rows. I can ask that in a separate question if need be

Any help is appreciated.

Dylan

This discussion has been closed.