Changes
Title
unchanged
CGridView: Render customized/complex datacolumns
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
CGridView
Content
changed
[...]
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 ...)[...]