Revision #4 has been created by Steve Friedl on Oct 12, 2011, 1:54:27 PM with the memo:
Updated to reflect viewData being available in CListView based on info from redguy
« previous (#3)
Special $variables in CGridView and CListView
CGridView, CListView, rendering
[...]* `$this->grid` - the [CGridView] object that owns the column
* `$this->grid->owner` - the owner of the grid, usually the calling controller
Passing your own variables
A very common request in the `#yii` channel is how to pass additional variables to the widget that are available by the rendering code.
Unfortunately, it's not so simple as it looks, so unless the variable is readily available in the controller (reachable by `$this` in `CListView` or `$this->grid->owner` in `CGridView`), you pretty much
have to extend the class
might look like:
View extends C
// in your controller
'dataProvider' => $dataProvider,
'itemView' => '_view', // partial rendering
'extraparam' => 1234 // your special parameter
This done, the extra parameter is available in
the `_view` as `$widget->extraparam`.
For `CGridView` it will be likewise, using `$this->grid->extraparam` from within each column to get at the parameter.