0

Using phpgrid.com to create a datagrid. Now i want to add a column named XYZ and with contents as ABC for all rows. Is it possible? The content is static for all rows and wont change at all. The column is not fetched from mysql table.

Hello Man
  • 693
  • 2
  • 12
  • 29

1 Answers1

3

You need to use virtual column add_column

http://phpgrid.com/example/virtual-column-aka-calculated-column/

$col_formatter = <<<COLFORMATTER
function(cellvalue, options, rowObject){    
    return "ABC";
}
COLFORMATTER;

$dg -> add_column(
        'XYZ', 
        array('name'=>'XYZ', 
            'index'=>'XYZ', 
            'width'=>'360', 
            'align'=>'left', 
            'sortable'=>false,
            'formatter'=>$col_formatter),
        'XYZ');
KSchoniov
  • 416
  • 4
  • 10