How to add row index to after rowGroup ?
How to add row index to after rowGroup ?

$(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
Try the
rowGroup().dataSrc()
API, for example:http://live.datatables.net/fuduzako/1/edit
Kevin
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
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
Yes thank you, this answer that I'm looking for, sorry for my bad in English. You save my time kthorngren