Answer the question
In order to leave comments, you need to log in
Yii1.1. How to fill a table cell with multiple values in CGridView? Or how to make multiple cells of one column per cell of another?
Given: the two tables of the table "firsts" and "seconds" are in the relationships "firsts" has_many "seconds" by the key "first_id".
I am trying to display the data of both tables in a CGridView. I want all the cells of the "name" column from the database to be placed in the "Seconds" column of the CGridView, and not just one. How to do it?
$Firsts = new CActiveDataProvider('firsts', array(
'criteria'=>array(
'with'=>array('seconds')
),
));
$this->widget('zii.widgets.grid.CGridView', Array(
'dataProvider'=>$Firsts,
'columns'=>Array(
'name',
'phone',
array(
'name'=>'Seconds',
'value'=>'$data->seconds[0]->name'
)
)));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question