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.
tri
(tri - Tommy Riboe)
2
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);',
),
fr0d0z
(Yiiframework)
4
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);',
),
albertski
(Albertski84)
5
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);',
),
?>