Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Bux on Nov 04, 2009 06:14
open dhtmlx forum
Group subtotal - how to display the subtotal at the bottom of group ?

Hi.

I am using the groupBy() method in order to display the subtotal of grouped rows.
My question is: is there any way to display the subtotal at the bottom of a sub-grouped rows ?

For example, supposing that I have the non-grouped grid:

Date | Country | Customers | Revenue
-----------------------------------------------
Jan/10/09 | USA | 12 | $100,00
Jan/11/09 | USA | 10 | $80,00
Jan/12/09 | UK | 7 | $95,00
Jan/13/09 | USA | 5 | $60,00
Jan/15/09 | UK | 4 | $110,00

Currently, after applying grouping by Country, I got the following:

Date | Country | Customers | Revenue
-----------------------------------------------
USA (3) | | 27 | $240,00
- - - - - - - - - - - - - - - - - - -
Jan/10/09 | USA | 12 | $100,00
Jan/11/09 | USA | 10 | $80,00
Jan/13/09 | USA | 5 | $60,00

UK (2) | | 11 | $205,00
- - - - - - - - - - - - - - - - - - -
Jan/12/09 | UK | 7 | $95,00
Jan/15/09 | UK | 4 | $110,00


How could I get the following display result (putting the sub-totals result at the bottom of each group) ?

Date | Country | Customers | Revenue
-----------------------------------------------
Jan/10/09 | USA | 12 | $100,00
Jan/11/09 | USA | 10 | $80,00
Jan/13/09 | USA | 5 | $60,00
- - - - - - - - - - - - - - - - - - -
USA (3) | | 27 | $240,00

Jan/12/09 | UK | 7 | $95,00
Jan/15/09 | UK | 4 | $110,00
- - - - - - - - - - - - - - - - - - -
UK (2) | | 11 | $205,00


Thanks.
Answer posted by dhxSupport on Nov 04, 2009 06:33
Unfortunately there is no way to do this with groupBy() functionality. You can try to use sub grid. In such case you can add any necessary footers at the bottom of the grid. Please find example here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/07_extended_modes/03_pro_subgrids.html