CGridView: Render customized/complex datacolumns

Comparing #13 with #14

Revision #14 was created by Joblo Joblo on Mar 18, 2013, 12:00:50 PM.

bugfix on column properties

Content

[...]
You can try to render a CListView (default actionIndex of a CRUD controller) into a cell too.

Access column properties
-----------------

In the examples above, I use different methods for each gridcolumn.
 So I didn't have to take care about the column properties.

If you want to use a single method for each column or need more information about the currently rendered column, add a third param (for example $dataColumn) to your called method:
[...]
//controller code
 
class ProductController extends Controller { ... protected function gridProductrenderGridCell($data,$row,$dataColumn)
{
//var_dump($dataColumn);
//$dataColumn is an instance of a [CDataColumn](http://www.yiiframework.com/doc/api/1.1/CDataColumn "CDataColumn")
//you have access to the properties and methods here (name, id, type, value, grid ...)
[...]