Hi Yii Masters!
I have a problem, what i cant solve it. I tried search the solution, but i cant find it (of course that is my mistakes ^^’).
So I have a Datagridview from $model, which show a Cars and Owners.
I want counting the same rows (see below the sample what i want)
<?php
$this->widget(‘application.extensions.NPager.NGridView’, array(
'id' => 'Car-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'ajaxUrl' => $this->ajaxUrl,
'cssFile' => Yii::app()->baseUrl . '/css/gridview/styles.css',
'template' => '{summary}{pagerlist}{pager}{items}{pager}',
'pagerlist' => array(
'8' => '8',
'10' => '10',
'25' => '25',
'50' => '50',
'100' => '100',
),
'textItemsPerPage' => 'per side',
'columns' => array(
array(
'name' => 'Owner',
'header' => 'Owner',
'type' => 'raw',
'filter' => CHtml::activeTextField($model, 'searchid', array('id'=>'Owner_tb'),
),
array(
'name' => 'Car',
'header' => 'Car',
'value' => '(is_object($data->car),
'type' => 'raw',
'filter' => CHtml::activeTextField($model, 'searchcar','id'=>'Car_tb'),
);
array(
'name' => 'Count',
'header' => 'Count',
'value' => <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />
'type' => 'raw',
);
?>
My result :
Owner | Car
Peter Company | BMW
Johs Company | Volvo
Peter Company | BMW
And what i want :
Owner | Car | Count
Peter Company | BMW | 2
Johs Company | Volvo | 1
Sorry for my bad english, but i hope its understandable
Thank you