Hello Yii Community!
I’m editing a custom view in order to print a PDF file using this Extension: application.extensions.MPDF53.mpdf.
but now I would like to print a CGridView but I’m getting this error:
"Object of class CGridView could not be converted to string" and of course, because I do not know how to print the CGridView object in the view… what should I do?
This is my code, I’m just putting the object like a string:
<tr class="odd">
<td> <b>Title</b> </td>
<td> '.$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'post-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'title',
'content',
'status',
'tags',
array(
'class'=>'CButtonColumn',
'template' => '{view} {update} {delete} {pdf}',
'buttons'=>array(
'pdf' => array(
'label'=>'Create PDF Report',
'url'=>"CHtml::normalizeUrl(array('pdf', 'id'=>\$data->id
))",
'imageUrl'=>Yii::app()->request->baseUrl.'/images/pdf.png',
'options' => array('class'=>'pdf'),
),
),
),
),
)).'</td>
</tr>
Thank you!