How to call a widget from CGridView?

Hello,

I want to put a widget in a CGridView column, but with "$this->widget…" is not working.

Can I call the widget statically or maybe something else?

Example:




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

	....

	'columns'=>

	    array(

                'name'=>'schedule',

                'value'=>'$this->widget(\'application.modules.mymodule.widgets.mywidget\');',

            ),



Thank you.

Try $this->grid->controller

/Tommy

Thanks.

The final solution (added ‘type’=>‘raw’ and third param “true”):




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

        ....

        'columns'=>

            array(

                'name'=>'schedule',

                'type'=>'raw',

                'value'=>'$this->widget(\'application.modules.mymodule.widgets.mywidget\', array(), true);',

            ),



Think you mean, this with the ->grid->controller-> added, don’t you?




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

        ....

        'columns'=>

            array(

                'name'=>'schedule',

                'type'=>'raw',

                'value'=>'$this->grid->controller->widget(\'application.modules.mymodule.widgets.mywidget\', array(), true);',

            ),



In my case I couldn’t get $this->grid->controller->widget to work, but Yii::app()->controller->widget did work


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

   ....

   'columns'=> array(

     'name'=>'schedule',

     'type'=>'raw',

     'value'=>'Yii::app()->controller->widget(\'application.modules.mymodule.widgets.mywidget\', array(), true);',

   ),

?>