Hi All
A lot of forum posts deal (moreorless) to this topic, but I can’t fnd solution to my problem.
I have a CGridView which is intended to display data of a specific model and data of others models (linked by belongsTo or Many, relationships)
I have a Marque (ex Volvo, Chrysler) which has several Modeles (V50 for Volvo for instance) And a Modele has several Version (A V50 could be 1.6l or 2.0l …)
I have this code:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'admin-version-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'nom',
array(//here is my problem, I have the name of the Marque displayed => OK But I can't perform any filter on it
'header'=>'Marque',
'name'=>'modele.marque.nom',
'sortable'=>true,
//'value'=>'AdminMarque::model()->findByPk(AdminModele::model()->findByPk($data->modele_id)->marque_id)->nom',
//'filter'=>CHtml::listData(AdminMarque::model()->findAll(), 'id', 'nom'),
),
array(
'name'=>'modele_id',
'value'=>'AdminMotorisation::model()->findByPk($data->modele_id)->nom',
),
array(
'name'=>'motorisation_id',
'value'=>'AdminMotorisation::model()->findByPk($data->motorisation_id)->nom',
),
array(
'class'=>'CButtonColumn',
),
),
)); ?>
I attached an image to have a look.
I also try with the commented line (that I de commented)
//'value'=>'AdminMarque::model()->findByPk(AdminModele::model()->findByPk($data->modele_id)->marque_id)->nom',
//'filter'=>CHtml::listData(AdminMarque::model()->findAll(), 'id', 'nom'),
But it is still the same problem …
I turn crazy…
Does someone have some hints ?
Thanks