Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Filter By Looked Up Value In Cgridview

$
0
0
Hi,

My early days of Yii. Have searched and can't find any clues on this hence post. I have modified the admin.php layout to lookup values from a couple of related tables as follows

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'silo-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		array(
			'name'=>'silo_id',
			'value'=>'$data->silo->name',
			'header'=>'Parent',
		),
		'name',
		array(
			'name'=>'silo_type',
			'value'=>'$data->siloType?$data->siloType->type:"no silo type"',
		),
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>



This is great and all works ... apart from the fact that the filter fields are still looking up the numerical values rather than the text values (e.g. I want to filter on a text 'description' rather than the UID that represents that description).

How do I go about changing this?
Thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>