Zii.widgets.grid.cgridview Full Match String

Hi guys!

I have this code in my admin.php in the views:


<?php $this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'empresas-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		array(

                    'name'=>'Nome',

                    'value'=>'Entidades::model()->findByPk($data->Id)->Nome',

                ),

                array(

                    'name'=>'IdCategoria',

                    'filter' =>  CHtml::listData(EmpresasCategorias::model()->findAll(), 'Id', 'Nome'),

                    'value'=>  'EmpresasCategorias::model()->findByPk($data->IdCategoria)->Nome',

                ),

		'Site',

                'Detalhes',

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>

But it has a problem with IdCategoria, it doesn’t apply a FULL MATCH on the ID, instead it does something like this:

if IdCategoria is 1, he will find all IdCategoria’s that have a ‘1’ in it, so search results will be 1,12,321,313,etc… anything with a ‘1’. How can i force it to full match it?

Thanks!

Also, in a field where its value comes from other object, how should i do the filter for it?


array(

                    'name'=>'Nome',

                    'value'=>'Entidades::model()->findByPk($data->Id)->Nome',  ----> Comes from another object type (Entidades instead of the current $model's type).

                    'filter'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />, ----> What should go here for him to look for Entidades with Nome = <user inputed Nome> ?

                ),

Please refer to this excellent wiki: http://www.yiiframework.com/wiki/281/searching-and-sorting-by-related-model-in-cgridview/