How to add row index to after rowGroup ?

How to add row index to after rowGroup ?

phireakphireak Posts: 4Questions: 2Answers: 0

$(document).ready(function() {
$('#example').DataTable( {
order: [[2, 'asc']],
rowGroup: {
startRender: null,
endRender: function ( rows, group ) {
return row_group_index + ' ' + group +' ('+rows.count()+')';
},
dataSrc: 2
}
} );
} );

ask u can see the example above I would like to add the row_group_index (1, 2, 3, 4, .etc...) along with the row group label like so. How can I do that ? Thank you.

with this example below I just want to add the row grouping index before each row grouping label.
https://datatables.net/extensions/rowgroup/examples/initialisation/endRender.html

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921
  • phireakphireak Posts: 4Questions: 2Answers: 0

    Thank kthorngren but your answer didn't help me out. in your example link I can see that all the indexes before grouping label is 2

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921
    edited December 2019 Answer ✓

    Sorry, I don't understand what you are trying to do. Thought you wanted to show the column index of the rowGroup dataSrc. What are the indexes you want? Are you wanting something like this where the counter increments for each row group?
    http://live.datatables.net/sunokapi/1/edit

    I use the draw event to reset the counter. Haven't tested the solution so you will need to if its what you are looking for.

    Kevin

  • phireakphireak Posts: 4Questions: 2Answers: 0

    Yes thank you, this answer that I'm looking for, sorry for my bad in English. You save my time kthorngren

This discussion has been closed.