Header grouping adds additional columns above the datagrid header rows, so that columns below appears in a group. Typical implementation looks like the screenshot below.
Use set_grid_method and set groupHeaders property. numberOfColumns determines number of column to span starting from startColumnName.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // Always include namespace and conf.php on TOP of the script. use phpCtrl\C_DataGrid; require_once("/file/path/to/conf.php"); $dg = new C_DataGrid("SELECT * FROM payments", "customerNumber", "orders"); $dg->set_col_width("customerNumber", 30); $dg->set_col_width("checkNumber",50); $dg->set_col_width("amount",50); $dg->set_grid_method('setGroupHeaders', array( array('useColSpanStyle'=>true), 'groupHeaders'=>array( array('startColumnName'=>'customerNumber', 'numberOfColumns'=>2, 'titleText'=>'Numbers Header') ))); $dg -> display(); |