create table with CGridView

please help me…

i want to create a table like 2296

using CGridView…

but i don’t understand to create with CGridView.

can someone help me to use CGridView to create table like 2296


hmm no answer kah ???

Possibly can be done by extending CDataColumn or perhaps create a new descendant to CGridColumn.

Also might be worth a try to use html/css formatting in header and data cells of the standard CDataColumn ("subcolumn" values are mutually exclusive).

(completely untested)


You can do this by adding a static method to your controller and calling it from the CGridView column assignment using a type=‘raw’ to allow HTML as part of the returned value.

For example:


array('name' => 'tabColumnX',

      'value' => 'MyController::rawTest($data->tabColumnA, $data->tabColumnB)',

      'type' => 'raw'),


Then in MyController:


public static function rawTest($colA, $colB) {

        $cond = 'FAILED';

        if ($colB > 1) {

            $cond = 'SUCCESS';


        return '<div class="raw">' . $colA . '<br/>' . $cond . '</div>';


You can obviously include whatever logic is required for your situation.

Note: There is an alternate syntax for calling a controller method, but I prefer the one above.