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
8
9
10
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM payments", "customerNumber", "payments");

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

$dg -> display();

 

See Live Example!