877-GRID-666 24/7 online support 604, Tower A, New Trade Plaza, N.T., Hong Kong

Column Grouping with Summary *

* Please note this feature is only available in paid versions.

 

Group Summary

 

phpGrid can group data by columns. Simply define a column name on which grouping occur using method set_group_properties().

In addition to define grouping column, set summary field using method set_group_summary() by passing the column name and summary type, which can be sum, count, avg, min, or max.

 

1
2
3
4
5
6
7
$dg = new C_DataGrid("SELECT * FROM payments", "customerNumber", "orders");

$dg->set_group_properties('customerNumber');
$dg->set_group_summary('amount','sum');
$dg->set_group_summary('checkNumber','count');

$dg -> display();

 

See Live Example!