Column Methods

Version 5.5.5 introduced set_grid_method() method. You can use this method to call any jqGrid javascript method that can perform actions on the grid as a whole. However, it’s not possible to manipulate the grid on a row or cell level using set_grid_method.

The example below demonstrates set_grid_method to grouping header by calling the jqGrid “setGroupHeader” method.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$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!