CGridView Error

I’m using the following code:


<?php $this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'users-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		'first_name',

		'last_name',

		'phone',

		'email',

		array(

			'name' => 'Test',

			'value' => array($this, 'gridDataColumn'),

		),

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>

I want one of the columns to pull the data from a controller method (see docs: http://www.yiiframework.com/wiki/278/cgridview-render-customized-complex-datacolumns/) but I’m getting this error:


Property "Users.Test" is not defined.

‘Users’ is the name of my model. It works if I add a property to ‘Users’ or if I use a property already existing on users, but I’d like to add a column generated on the fly using the data from the row (ie I don’t want to add a property to my model)

Does your controller have a method called ‘gridDataColumn’? Can you post the code here?

I actually use an alternative syntax to call controller methods.


...

'value' => 'MyController::mymethod($data->myvar)',

...

I’ve never tried the way detailed in the link you provided. My way also works for calling any class method, not just the calling controller.




'columns' => array(

  //...

  array(

	'header' => 'Test',

	'value' => array($this, 'gridDataColumn'),

  ),

  //...

),



CGridColumn::$header