Я думаю, что лучший способ добиться того, что вы хотите использовать пользовательские функции в модели CActiveRecord (если у Вас есть CActiveDataprovider для сетки), и положить, что «вложенной таблицы» в обычной колонке :
| Transaction | Item | Price | Total |
------------------------------------------
| T-001 | I-1 | $50 | $100 |
| I-2 | $50 |
------------------------------------------
| T-002 | I-3 | $90 | $90 |
------------------------------------------
в вашей модели вы, чтобы определить ПОЛУЧИТЬ функции, которые возвращают данные в формате HTML с разрывами строк (например, с помощью BR:
class Item extends CActiveRecord {
...
public function getIdItems()
{
$string = '';
foreach($this->items as $item) {
if ($string != '') $string .= '<br/>';
$string .= ' '.$item->textId; // 'I-3', 'I-2'...
}
return $string;
}
public function getPriceItems()
{
$string = '';
foreach($this->items as $item) {
if ($string != '') $string .= '<br/>';
$string .= ' '.$item->price; // $50, $90...
}
return $string;
}
...
}
И показать-е е новые столбцы в сетке:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'anotacionesGrid',
'dataProvider'=>$dataProvider,
'columns'=>array(
'transaction',
'idItems:html:Item',
'priceItems:html:Price',
'total'
)
);