You always can set path for itemView as alias
$this->widget('zii.widgets.CListView', array(
'itemView'=>'application.views.grid._view'
Вопрос
I have a widget that renders a file. From there, it has a clistview. But the path is not working. I am getting the error require(): Filename cannot be empty
.
So originally I had the page render from $model, but I realized I should be using clistview. It works fine if I just do a renderPartial $model but it doesn't work in clistview.
from my widget:
$this->renderFile(Yii::getPathOfAlias('application.views.grid'). '/index.php',
array('product'=>$product));
pass to my grid/index.php. I'm showing both ways I had. The top one works but I would need to do a foreach loop. I want to get rid of that due to pagination problems, so I want to use clistview.
<?php
// this works fine, but not what I want.
// $this->controller->renderPartial('//grid/_view',array(
// 'product'=>$product,
// ))
?>
<?php
// $path = '//grid/_view'; I've tried something like this and put it in itemView. It doesn't work.
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$product,
'itemView'=>'//grid/_view',
'template' => '{pager}{items}',
);
?>
Решение
You always can set path for itemView as alias
$this->widget('zii.widgets.CListView', array(
'itemView'=>'application.views.grid._view'