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

Header Grouping

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.

header-grouping

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
$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();

See Live Example!