I’m trying to create a cgridview display that would look like:
Name 1 | Name 2 | Name 3
Name 4 | Name 5 | Name 6
Name 7 | Name 8 | Name 9
and so on until the end of dataProvider.
View Code:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'name'=>',
'type'=>'raw',
'value'=>'CHtml::encode($data->name)',
),
array(
'name'=>'',
'type'=>'raw',
'value'=>'CHtml::link($this->grid->dataProvider->data[$row+1]->name,Yii::app()->request->baseUrl."/index.php/")',
),
array(
'name'=>'',
'type'=>'raw',
'value'=>'CHtml::link($this->grid->dataProvider->data[$row+2]->name,Yii::app()->request->baseUrl."/index.php/")',
),
),
));
$row+1 returns an Undefined offset: 10 error.
Hard coding $this->grid->dataProvider->data[1]->name and $this->grid->dataProvider->data[2]->name will return the first three names but the second row starts out with the second name instead of the fourth.
Is there a way to accomplish what I am trying to do using cgridview?