RowGroup endRender - Can I show totals for entire group, instead of just the displayed rows?
RowGroup endRender - Can I show totals for entire group, instead of just the displayed rows?
I'm using the rowGroup and endRender to generate a total for my groups...
I'm basing it on this example: https://datatables.net/extensions/rowgroup/examples/initialisation/customRow.html
However, I've noticed that the endRender row that is inserted only shows the data for the currently displayed rows on the "page". For example: If you search for London in the above example, there are 12 rows. By default the table shows 10 rows, so 2 are pushed to the next page. (this is fine, that's what is supposed to happen) However, the "Averages for London" values, displayed at the bottom, are calculated with only the displayed rows. If you go to page 2, the averages change to be calculated with only the two rows that are displayed.
Is there a way to either: Have the row display the total for the entire group, even if the group spans pages, or to not display a summary row until after the last row in the group?
I've done some searches and haven't found what I'm looking for. It could be I just haven't used the correct combination of terms, so if there is an answer elsewhere, please point me there.
Thanks in advance.
This question has an accepted answers - jump to answer
Answers
Hi @fatman502 ,
This here should do the trick for your first point. I only did Age, but Salary would be the same - here, the average for displayed is shown, with the average overall in brackets.
This thread here from a few days ago shows how you can do rendering only for the final part of a group. I just flag that line, but it should be fairly easy to put in your averages on that line.
Hope that helps,
Cheers,
Colin
@colin
This really helped.
I'm glad to see that I was at least headed in the right direction for the first way of displaying the results. I just never got the "allRows" part to work correctly.
Now I just need to figure out which of the two ways to do it.
Thanks again.